由网友(萝莉味软妹酥)分享简介:我有一个关于重写规则的两个问题,但他们都是密切相关的,所以我希望这是好的。我问他们两个在一个单一的岗位。I have two questions regarding RewriteRule, but they're both closely related so I hope it's OK I ask them b...
我有一个关于重写规则的两个问题,但他们都是密切相关的,所以我希望这是好的。我问他们两个在一个单一的岗位。
I have two questions regarding RewriteRule, but they're both closely related so I hope it's OK I ask them both in a single post.
首先,我想脱光尾随 index.html的
的任何URL的结尾,例如:
The first is that I'd like to strip trailing index.html
's from the end of any URL, e.g.:
http://www.example.com/index.html -> http://www.example.com/
二是要显示在浏览器的地址栏中的URL http://www.example.com/contact/
所有以下网址:
http://www.example.com/contact/
http://www.example.com/contact/index.html
http://www.example.com/contact/success.html
http://www.example.com/contact/failure.html
例如,如果用户被重定向到 http://www.example.com/contact/success.html
我想该网页显示给他们,但 http://www.example.com/contact/
作为URL。这可能吗?
For example, if the user is redirected to http://www.example.com/contact/success.html
I'd like that page to be displayed to them, but with http://www.example.com/contact/
as the URL. Is that possible?
推荐答案
对于指数:
RewriteRule ^(.*)/index.html /$1/ [R]
二:
RewriteRule ^contact/(success|failure).html /contact/ [L]
相关推荐
最新文章