Forum Moderators: phranque
I use the following redirect rule for all URLs on my site so that they fit in with my CMS:
RewriteRule %{REQUEST_FILENAME} index.php [L,NC]
RewriteRule ^([^\.]+)(/)?$ index.php?x=$1 [L,NC]
Now, although domain.com/foo/bar may work, domain.com/foo/bar/ will 404.
How can I make it so that both work (or they rewrite to the non-trailing slash version in certain directories like files in "foo")
RewriteRule ^(([^/]+/)*(^./)+)/?$ index.php?x=$1 [L]
The [NC] flag is not needed, since no literal alphabetic characters are specified in the pattern.
Jim
RewriteRule ^(([^/]+/)*([^./]+))/?$ index.php?x=$1 [L]
As for the first rule, RewriteRule can't examine %{REQUEST_FILENAME} like that. It expects a regular-expressions pattern there. See the Apache docs for more info.
Jim
[edited by: jdMorgan at 8:07 pm (utc) on June 19, 2007]
I'm not sure how it would, so I'm hiding behind the generalized/theoretical language here... :)
Simply put, only index.php can decide if the value for the "x" parameter is "good" and assign any meaning to it.
Jim