Forum Moderators: phranque
RewriteCond %{THE_REQUEST} /([a-z]+)/\ HTTP/
RewriteRule /$ http://www.example.com/%1.html [R=301,L] msg:4599032 - In this case /([a-z]+)/ picks that last directory. So if my directory name is /level-3/ I would be better with /([^/]+)/ ?
msg:4599046 - wondering why g1 passed up the chance to give a sales pitch for extensionless filename URLs
example.com/some/other/thing are redirected to example.com/some/other/thing/ and then on to example.com/thing which you might not want. Additionally, if that request is somehow redirected to example.com/thing/ there's the potential for a redirect loop. I guess that it's best to not "go extensionless" until those types of issues and clashes have been fully catered for. msg:4599050 - www.example.com/products/level2/level3/level4/ to www.example.com/level4/
[edited by: g1smd at 11:29 am (utc) on Aug 3, 2013]
Please fill in the Rule that follows that Condition; otherwise I am confused as to exactly what you are trying to do.
[^/]+ as the pattern. I would use [a-z0-9-]+ for the pattern. example.com/product/foo/bar/?name=/junk/ will be redirected to www.example.com/junk and whether you want to take extra steps to prevent that is up to you. Thanks for clarifying the question. :) Clear wording and examples are crucial.