开发者

.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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜