A Digital Age Deserves A Digital Leader

Apache Rewrite Rule

Apache Rewrite Rule

Postby imnuts » Sun Mar 30, 2008 1:03 am

I'm not sure if anyone here will be able to help out on this or not, but I'm trying to make a portion of a site i'm building more search friendly, at least partially. To do so, I want to use the rewrite rules of apache to turn a php page into what appears to be a static page. Unfortunately, what I came up with isn't working, so I don't know if it's the rule isn't written properly or the apache server just doesn't like me (which is also possible). The re-write rule is working for wordpress, so I'm thinking that my rule isn't good. What I want to do is take "details.php?rid=#" where the '#' is replaced by a number and convert that url to "details/#", so basically get rid of the ".php?rid=" in the URL that people see. What I have right now is
Code: Select all
RewriteRule /details/(.+) /details.php?rid=$1

Based on the not so good documentation in the apache manual, that should work, but it isn't. So can anyone confirm what I have as the right code for what i want to do or help me fix it?
User avatar
Posts: 7457
Joined: Wed Mar 24, 2004 5:19 am
Location: Boothwyn, Pennsylvania
Real Name: Mark

Postby jbullard » Sun Mar 30, 2008 6:02 am

Try this

Code: Select all
RewriteEngine onRewriteRule ^details/(.*?).html$ /details.php?rid=$1

This will take it and turn it into a static HTML page. I haven't tested it so let me now if it doesn't work. :yesnod:
VP - Software
User avatar
Posts: 3653
Joined: Sun Jun 06, 2004 10:17 pm
Location: Utah
Real Name: Jason Bullard

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 0 guests