AusGamers Forums
Show: per page
1
mod_rewrite help
3dee
Brisbane, Queensland
3613 posts
My website uses a custom CMS and as such each page is viewed by putting in a name.

i.e: site.com/?page=news

However I have been trying to get the .htaccess file to rewrite the menu items (news, about, pictures etc) to faux-folders.

/news should rewrite to /?page=news however I have a problem.

My current code works but not when you add a trailing slash to the faux-URL :(

RewriteEngine on
RewriteRule ^(news|about|calendar|pictures|contact)/*$ /?page=$1


This works if I put in something like /news or /pictures but I'm having problems when you add a trailing slash such as /news/ or /pictures/.

The website loads the correct page but somehow fudges up the actual folder so no CSS gets applied and no images are applied. Its as if the "working directory" for the website is now /pictures/ instead of just the main folder so relative paths in the page content break!

Any ideas? Tried a number of things and much Googling...
05:51pm 06/06/09 Permalink
adBot
ads
Internet
--
ads keep websites free
05:51pm 06/06/09 Permalink
3dee
Brisbane, Queensland
3614 posts
Hmm, it works if I put in [R] flag but then you see the query URL.
05:57pm 06/06/09 Permalink
Jim
Brisbane, Queensland
9769 posts
what's the url so I can debug it
06:00pm 06/06/09 Permalink
thermite
Brisbane, Queensland
1691 posts
Do a 301 redirect via PHP if there is a trailing slash
06:00pm 06/06/09 Permalink
3dee
Brisbane, Queensland
3615 posts
Hmm I might just leave it with [R].
06:08pm 06/06/09 Permalink
Insom
Brisbane, Queensland
2954 posts
sounds like you need absolute rather than relative paths
06:09pm 06/06/09 Permalink
euphoria
Gold Coast, Queensland
1203 posts
I feel your pain. Debugging rewrite rules is a nightmare. Regex gives me headaches.
06:46pm 06/06/09 Permalink
adBot
ads
Internet
--
ads keep websites free
06:46pm 06/06/09 Permalink
AusGamers Forums
Show: per page
1
This thread is archived and cannot be replied to.
 

Advertise with Us | Download Media Kit | Privacy Policy | Contact Us
© Copyright 2001-2013 AusGamers™ Pty Ltd. ACN 093 772 242.
A Mammoth Media web development, hosted by Mammoth VPS.