I would like to write a mod_rewrite rule which would allow me to redirect any URL without a trailing '/' to a certain URL. I would also like to store the everything after the final '/' as a variable which i can pass on to my pre-defined URL. I am having some difficulty getting the regular expression to work and was hoping someone more experienced may be able to help.
so
/foo/bar/blarn would match and $1 would = blarn
/foo/bar/blarn/sneh would match and $1 would = sneh
/foo would match and $1 would = foo
/foo/bar/blarn/ would not match and would continue to be matched against other
rules
So far i have tried a lot of combinations.
This works if i add the extension .xhtml
RewriteRule \/([a-z]*)\.xhtml$
however i would like to detect the absence of any trailing characters so i tried a negative look ahead assertion
RewriteRule \/([a-z]*)?!\/$
This compiles, but doesn't achieve the desired results.
Any ideas ?