Sorry if this is a really dumb question – I can’t find the answer anywhere…
I’m storing my test files in a subdirectory called ‘dev’, and using the following rewrite rule so that requests to /dev/VAR1/VAR2 will take me to /index.php?page=VAR1/VAR2, and requests to /dev/VAR1/ will take me to /index.php?page=VAR1
(VAR1 and VAR2 are variables, and the folders/subdirectories won’t really exist)
RewriteBase /dev
RewriteRule ^([A-Za-z/\-]+)/$ index.php?page=$1
This is doing it fine – my index.php is getting the right variables. The problem is that the server or page (or I don’t understand what…) thinks I’m actually in the non-existent folder (or subdirectory) which is VAR1, so all my relative (if that’s the right word) addresses for images and links and css and scripts etc
<link rel="stylesheet" type="text/css" href="./sitefiles/mystyles.css" />
all work as if they were /dev/VAR1/sitefiles/mystyles.css – basically, the server thinks it’s actually in the ‘fake’ folder.
Is there a way I can continue to use these relative addresses with my mod_rewrite, or do I have to use ‘absolute’ addresses with the complete path?
Thanks for any help!
We’re using the same stuff with our configuration and rewriting fake aliases to index.php?something=$1 we have to put our CSS files into the /styles/ of the DocumentRoot and don’t use relative ./ path use the absolute path like href=”/sitefiles/mystyles.css” it should work fine.