Help with mod rewrite problem
Was wondering if anyone could shed any light on a strange problem I'm having with mod_rewrite:
I'm trying to rewrite urls so that www.domain.com/mycategory
displays the page www.domain.com/page.php?catid=1.
My rewrite rule is
This works fine, until I go to www.domain.com/mycategory/
RewriteRule ^mycategory/?$ page.php?catid=1
Note the final /.
I know there must be a simple way to solve this without having to use absolute references for CSS (which I don't want to do because I want to be able to use the exact same pages for my offline testing).
Any ideas appreciated,
I've been there, and spent a long time trying to figure out what to do to fix that problem too. I came to the conclusion to use the <base> tag in your HTML document head tag.
EDIT: As for your offline testing, I usually use a conditional php statement based on $_SERVER['SERVER_NAME'] whether to include
<base href="http://localhost/" />
and that way, I never have to change anything in my code when I upload my pages to my server, because the PH conditional just picks out which base tag to use.
<base href="http://www.myserver.com/" />
Thanks, that does seem like a good solution - will look into this.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread