I have a website which has so many sub folders in it. I have following paths references to my js and css files.
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<script type="text/javascript" src="js/jquery.js"></script>
the above code is working fine on my local machine. the JS file is not loading when i host the website into production server. Problem in my hosting server is my website is ponted to
instead
. When I load the page with http://www.somewebsitename.com/home.aspx this url it is loading all the js files it is not loading files only when I load the page with http://www.somewebsitename.com.
Please solve my problem. How to reference JS files so that they ll loaded how ever u visit the page.
Change:
To:
The leading slashes are a way to say “hey, I’d like you to start from the root of the website and work from there”.
So, providing the JS and CSS folders are in the root of the website, it won’t matter where you link these files from…sub folders or not, it will always look to the root and work down.
Good luck.
Michael.