RewriteRule 重命名 URL?
我有两个关于 RewriteRule 的问题,但它们都是密切相关的,所以我希望我可以在一篇文章中问它们。
第一个是我想从任何 URL 的末尾删除尾随 index.html
,例如:
http://www.example.com/index.html -> http://www.example.com/
第二个是显示 URL http://www.example。对于以下所有 URL,浏览器地址栏中的 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。这可能吗?
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.
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/
The second is to display the URL http://www.example.com/contact/
in the browser's address bar for all of the following URLs:
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
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于索引:
第二:
For the index:
Second: