Black_Knight
04-07-2009, 07:04 AM
Hi,
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
RewriteRule ^mycategory/?$ page.php?catid=1
This works fine, until I go to www.domain.com/mycategory/
Note the final /.
The rewrite rule works BUT all my CSS & JavaScript includes fail, apparently because they are relative references of the form href="./css/styles.css" etc and now the active directory appears to be one level deeper because of the trailing /.
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,
Thanks
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
RewriteRule ^mycategory/?$ page.php?catid=1
This works fine, until I go to www.domain.com/mycategory/
Note the final /.
The rewrite rule works BUT all my CSS & JavaScript includes fail, apparently because they are relative references of the form href="./css/styles.css" etc and now the active directory appears to be one level deeper because of the trailing /.
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,
Thanks