Kraetos
2008-06-13, 15:22
So, mod_rewrite is pretty cool but I can't figure out how to deal with trailing slashes.
I include trailing slashes in all my URLs. But I need to take users who don't toss that slash on at the end of a URL into account. So, when someone goes to:
mysite.com/tutorial/one/whitespace
it needs to redirect to:
mysite.com/tutorial/one/whitespace/
At which point the rest of my rewrite rules take over and sends them to:
mysite.com/tutorial/index.php?page=whitespace
This was my best shot:
RewriteRule ^([.]+)$ $1/ [R]
Didn't work. Anyone know what would?
I include trailing slashes in all my URLs. But I need to take users who don't toss that slash on at the end of a URL into account. So, when someone goes to:
mysite.com/tutorial/one/whitespace
it needs to redirect to:
mysite.com/tutorial/one/whitespace/
At which point the rest of my rewrite rules take over and sends them to:
mysite.com/tutorial/index.php?page=whitespace
This was my best shot:
RewriteRule ^([.]+)$ $1/ [R]
Didn't work. Anyone know what would?