1

I have created an instance on AWS and installed a LAMP stack on it as per their tutorials and installed an existing magento site on to it.

I pointed my local hosts file at the new server, cleared the var folder (including the cache) and the site loaded. Great!

But none of my Javascript files were loading. Not a single one, so I looked at the URLs they were trying to load from and it's done something very strange.

It has added the path to the root directory after the domain like so:

https://example.com/{pathtoroot}/media/js/myfiles.js

Causing the 403 forbidden error on every js file. CSS files and images which use the same root URL as per the magento config are loading perfectly.

URL rewrites are working fine, and if I try to access the correct link directly, it loads the file. I've tried messing about with the root urls but found nothing works and the site works on another (cPanel) server.

I'm sure I'm missing a server setting somewhere, but I've been playing around for ages and found nothing.

Thanks in advance for any help :)

3
  • UPDATE: In the source it is not adding the domain src="/var/www/html/js/prototype/validation.js"
    – user9654
    Feb 5, 2018 at 12:29
  • 1
    Today I encountered the same issue. The issue was missing media folder.
    – roshni
    Mar 12, 2018 at 11:44
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review Mar 12, 2018 at 12:18

2 Answers 2

3

Today I encountered the same issue. The issue was missing media folder.

5
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review Mar 12, 2018 at 12:18
  • @roshi, please write little bit about solution.So, that other can understand the anwer
    – Amit Bera
    Mar 13, 2018 at 8:55
  • @RamaChandranM, Sorry We have undo this delete of this question as we are getting some meaningful for this post.Any way thanks for continuation
    – Amit Bera
    Mar 13, 2018 at 8:57
  • 1
    @AmitBera i wish i can edit your comment ;) Mar 14, 2018 at 7:53
  • 1
    ha ha.... you can do oneday:)
    – Amit Bera
    Mar 14, 2018 at 8:07
0

Try:

sudo chown -R www-data:www-data media/ var/
rm -rf var/cache/* && rm -rf var/session/*

Worked perfectly for me.

Your Answer

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

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