Reputation: 117
This is my .htaccess file:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.php
This is my folder structure
testsite/index.php
testsite/css/style.css
testsite/.htaccess
The problem:
Whenever I goto http://localhost/testsite/
it loads the css fine.
But whenever I goto http://localhost/testsite/abc/test/
the css does not render because it is trying to get it from testsite/abc/test/css.
I would rather not use the full web address to each file or have to dynamically test the hierarchy level then go ../css/style.css
Thanks so much in advanced,
Nick
Upvotes: 2
Views: 163
Reputation: 7739
You can add the base tag to the head tag in each of your pages :
<base href="/testsite/">
This way, the browser will prepend all the css in that page by /testsite/
.
For more informations about the base tag, see documentation
Upvotes: 1