Web Hosting Talk







View Full Version : Need help with mod_rewrite


OneBinary
05-15-2005, 01:52 PM
Hello All,

I'm having a tough time getting my rewrite to work. I have the following URL in the following format:

domain.com/details.php?image_id=14

I want to rewrite that to something static, like maybe:

domain.com/details/14

I have the following code in my .htaccess, but it's not working:

RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteRule ^/details/([^.]+)$ /details.php?image_id=$1


Any ideas?

Thanks,
-Kevin

OneBinary
05-15-2005, 02:48 PM
Nevermind, was not an issue with mod_rewrite, but an issue with the script I was using.

jwnichols
05-17-2005, 11:56 AM
Here's what I use that's very similar:

RewriteRule ^([A-Za-z]+)$ $1/ [R]
RewriteRule ^([A-Za-z]+)/$ index.php?section=$1 [L]

It takes something like site.com/url and redirects it to site.com/url/
Then my second regex does the url rewriting.