I'm not even sure if I'm going about this the right way, so I'm going to present the entire problem here.
I have a site with URLs that look like this:
www.example.com/some-random-key/page.php
and I'm redirecting like so:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)/(.*?)$ $2?key=$1
and this MOSTLY working. My problem is the following two URLs end up not being equivilent:
www.example.com/my-key
www.example.com/my-key/
The 2nd example behaves as expected, redirecting to index.php at the root level, and passing along 'my-key' as the parameter.
The first example fails with a not found error.
Is there a way to add a rule that says if the file isnt found, then fetch index.php?key=$key or am I approaching this from the wrong angle?
RewriteRule ^(.*)$ index.php?key=$1 [L]right afterRewriteRule ^(.*?)/(.*?)$ $2?key=$1and tell me how it goes. – Prix Oct 20 '10 at 1:49