Forum Moderators: phranque
RewriteEngine on
RewriteRule ^old\.html$ new.html
RewriteRule ^([0-9]+)$ index.php?id=$1
RewriteRule ^([0-9]+)/$ index.php?id=$1
However, I've seen that repeating the same condition like that (without the slash) isn't good - instead, do a redirect:
RewriteEngine on
RewriteRule ^old\.html$ new.html
RewriteRule ^([0-9]+)$ $1/ [R]
RewriteRule ^([0-9]+)/$ index.php?id=$1
This should do something like redirect localhost/42 to localhost/42/, at which point the second re-write rule will take place, transparently re-writing to index.php?id=42. However, with the "[R]" modifier, it instead redirects to "http://localhost/C:/Apache/Apache2/htdocs/42". Anyone know what's wrong with this?