.htaccess redirect 404 error to directory if it exists
Is there any way to make /name.html and /name/ work interoperably in the ev开发者_StackOverflow社区ent of a 404 error?
For example, if the following fails: http://domain.com/name.html
Then it would attempt: http://domain.com/name/
And only go to a 404 page if that directory didn't exist? The reverse would be interesting too, going from dir to .html, and then finally to 404 on a double fail.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^([a-zA-Z0-9-]+)\.html$ $1/ [L]
精彩评论