2

I created a dump of our live database and imported it to my test environment.

My project is in /srv/www/vhosts/example. it tries to load js/mage/cookies.js from http://example.com/srv/www/vhosts/blizz/js/mage/cookies.js instead of from http://example.com/js/mage/cookies.js

I checked my base urls and cookie domain, this is the output of my ./n98-magerun.phar sys:check:

✔ Secure BaseURL: http://example.com/ of Store: example_v18 - OK
✔ Secure BaseURL: http://example.gala/ of Store: example_gala_v18 - OK
✔ Secure BaseURL: http://example.ch/ of Store: example_ch - OK
✔ Unsecure BaseURL: http://example.com/ of Store: example_v18- OK
✔ Unsecure BaseURL: http://example.gala/ of Store: example_gala_v18 - OK
✔ Unsecure BaseURL: http://example.ch/ of Store: example_ch - OK
✔ Cookie Domain (secure): example.com of Store: example_v18 - OK
✔ Empty cookie Domain (secure) of Store: example_gala_v18 - OK
✔ Empty cookie Domain (secure) of Store: example_ch  - OK
✔ Cookie Domain (unsecure): example.com of Store: example_v18 - OK
✔ Empty cookie Domain (unsecure) of Store: example_gala_v18 - OK
✔ Empty cookie Domain (unsecure) of Store: example_ch - OK
3
  • Have you check your htaccess file? Commented Mar 4, 2019 at 12:07
  • Do you use the standard Magento configuration approach for loading JS? E.g. <action method="addJs"><script>mage/cookies.js</script></action> for block page/html_head in page.xml layout?
    – HelgeB
    Commented Mar 4, 2019 at 12:29
  • @HelgeB, yes, it works as it should in live
    – Black
    Commented Mar 4, 2019 at 12:38

1 Answer 1

1

There is at some point the base directory included in your urls (Mage::getBaseDir()) and that shouldn't happen.

If you have enabled javascript file merging in your admin panel, the following could happen: The base directory is used in the process of merging js files. Before merging the files the base directory path is appended and then all files are passed to a core helper function for merging. If everything works well at that point you get a path to a merged file and that is referenced in the html code. If the saving of the merged file fails maybe there remains the appended base directory and your strange urls are rendered. In the case of failure you should get an entry in your exception.log if logging is enabled.

So I would suggest the following:

  1. Check if you have the JS merging activated in admin panel and if yes deactivate it and see if that solves your problem.
  2. If you need the merging of JS files check that the location where the merged file is saved is writable in your test system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.