Modulshop - Eine große Auswahl an neuen und hilfreichen Modulen für die modified eCommerce Shopsoftware
Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: Cannot find javascript when URL rewrite is ON

    blaupunkt

    • Neu im Forum
    • Beiträge: 26
    Cannot find javascript when URL rewrite is ON
    am: 28. Juli 2014, 15:48:16
    The website I'm working on has url rewriting switched on so when a user visits *.com/product_info.php?products_id=1 in the address bar he'll see `mywebsite.com/productname`.

    I just finished building the mobile version of this website but because of this url rewriting the jquery/css files are not included properly. Here is an example:

    In my html file I have:

    <link rel="stylesheet" href="templates/xtc5m/javascript/jquery.mobile-1.4.2.min.css">
    <script src="templates/xtc5m/javascript/jquery.mobile-1.4.2.min.js"></script>

    And this is working properly on the local host, but when I run it from the server the script files are being called after the product name like that:

    `http://www.website.com/somecategory/subcategory/name/templates/xtc5m/stylesheet.css`

    Which is wrong and I get error 404 in the console.

    Any suggestion how I should include those files?

    Linkback: https://www.modified-shop.org/forum/index.php?topic=30732.0

    noRiddle (revilonetz)

    • Experte
    • Beiträge: 13.990
    • Geschlecht:
    Re: Cannot find javascript when URL rewrite is ON
    Antwort #1 am: 28. Juli 2014, 16:19:10
    Where do you implement theses css and javascript files ?
    Hopefully in /templates/YOUR_TEMPLATE/javascript/general.js.php and /templates/YOUR_TEMPLATE/css/general.css.php ?
    There it has to look like this (example *.js):
    Code: XML  [Auswählen]
    <script src="<?php echo 'templates/'.CURRENT_TEMPLATE; ?>/javascript/jquery.mobile-1.4.2.min.js" type="text/javascript"></script>

    If this doesn't work you should tell us what kind of SEO-URL module you use, or even better, show us some code of the rewrites you use.
    With the default one (SHOPSTATS) everything should work properly.

    Regards,
    noRiddle

    Matt

    • Experte
    • Beiträge: 4.241
    Re: Cannot find javascript when URL rewrite is ON
    Antwort #2 am: 28. Juli 2014, 17:00:55
    Sounds like <base href> is missing...
               
    anything