非常基本的重写规则问题
我有这个网址:
http://www.mydomain.com/index.html
并且想要一个规则将上面的内容重写为:
http://www.mydomain.com
换句话说,删除代码的index.html部分...
可能是这样的:
RewriteRule ^$ index.html [NC]
谢谢
更新:
当您在中输入www.domain.com时浏览器,当然index.html被打开。 但是,当您单击我网站菜单上的“主页”时,会显示整个完整网址,这是我想避免的。因此,当点击“home”时,会显示 www.domain.com/index.html...但在地址栏中输入 www.domain.com 时不会显示,那么只会显示该内容,但无论如何都会出现 index.html。
所以是的,我需要这个:
www.domain.com/
不是这个:
www.domain.com/index.html
谢谢
I have this url:
http://www.mydomain.com/index.html
And want a rule to rewrite the above into this:
http://www.mydomain.com
In other words, remove the index.html part of the code...
Something like this maybe:
RewriteRule ^$ index.html [NC]
Thanks
UPDATE:
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
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 /index.html 的请求重定向到 /
To redirect requests for /index.html to /
我认为它是这样的:
将“index.html”替换为“/”,而不是“”替换为“index.html”
I think its like this:
Replace "index.html" with "/", not "" with "index.html"