问题描述
我有这个网址:
http://www.mydomain.com/index.html
和希望的规则重写到上述这样的:
And want a rule to rewrite the above into this:
http://www.mydomain.com
在换句话说,删除的code中的index.html的部分...
In other words, remove the index.html part of the code...
事情是这样的,也许:
RewriteRule ^$ index.html [NC]
感谢
更新:
当你输入www.domain.com到浏览器中,offcourse的index.html打开。 但是,当你在我的网站的菜单上点击家,将显示整个完整的URL,这是我想避免的。所以打的时候家www.domain.com/index.html显示...但在地址栏中输入www.domain.com时没有,那么只有将显示,但index.html的出现反正。
When you type www.domain.com into the browser, offcourse index.html is opened. But when you click on "home" on the menu on my website, the entire full url is displayed, which I want to avoid. So when hitting "home" www.domain.com/index.html is shown... But not when entering www.domain.com in the adress bar, then only that will show, but index.html comes up anyways.
所以,是的,我需要这样的:
So yes, I need this:
www.domain.com/
不是这样的:
Not this:
www.domain.com/index.html
感谢
推荐答案
要重定向到请求/index.html /
To redirect requests for /index.html to /
RewriteRule ^index.html$ http://www.mydomain.com/ [R=301,L]