DeX Posted October 12, 2015 Share Posted October 12, 2015 (edited) I have an Amazon web server which I host maybe 5 websites on and one of them is a portal I'm building for a client. Everything works great except when I load a page that uses JavaScript files, the console complains that it can't find any of the files, so therefore none of the JavaScript code on the page works. Here is a comprehensive list of things I have tried: 1. I put a test.html file in the JavaScript directory and tried to load it in my browser. My browser told me it didn't exist, 404 error. 2. I created a javascript2 folder and put the test.html file in there, it loaded no problem. 3. I moved all of my JavaScript files out into the javascript2 folder and changed all the reference links in the HTML to point to the new folder. The page and all JavaScript functions worked perfectly. 4. I did a "locate .htaccess" on my server (Linux) and it didn't return anything inside the /var/www/X directory for the website. There were 1 or 2 inside some other /var/www/X2 or /var/www/X3 directories but none of them specified anything for a javascript directory. 5. I restarted Apache2 and restarted the server many times. 6. When I visit X/javascript/test.html in my browser, watch it fail, then check my Apache2 logs, nothing was added. For some reason my web server can find every file except for anything inside that javascript directory, I have no idea why. Edited October 12, 2015 by DeX Quote Link to comment Share on other sites More sharing options...
scootstah Posted October 12, 2015 Share Posted October 12, 2015 There is probably a /javascript alias in your Apache2 configuration that is pointing somewhere else. When you visit example.com/javascript, it's not actually looking in <documentroot>/javascript. Quote Link to comment Share on other sites More sharing options...
DeX Posted October 12, 2015 Author Share Posted October 12, 2015 7. I have other websites running on the same webserver and their code can find their respective javascript folders fine. 8. I didn't customize Apache2 at all, I just installed the default setup. Quote Link to comment Share on other sites More sharing options...
Solution scootstah Posted October 12, 2015 Solution Share Posted October 12, 2015 It's part of the default installation, for some stupid reason. Try running these commands on your server: sudo a2disconf javascript-common sudo service apache2 restart Quote Link to comment Share on other sites More sharing options...
DeX Posted October 13, 2015 Author Share Posted October 13, 2015 Wow that worked perfectly, thanks! I wonder why it does that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.