.htaccess 重定向
我想重定向 http://localhost/xyz index.php。该index.php位于/var/www/xyz/中。我有一个特定的理由这样做。
RewriteRule http://localhost/xyz index.php 不起作用,我不知道为什么
谢谢 让
I want to redirect http://localhost/xyz index.php. This index.php is in the /var/www/xyz/. I have a specific reason to do this.
RewriteRule http://localhost/xyz index.php does not work, I have no idea why
Thanks
Jean
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将规则应用于路径,而不是 url (=leave http://localhost)。
此规则也适用于 /bla/xyz 和 /xyzabc。甚至到/blah/xyzabc。可以更改第一个参数以禁止这样做:
如果您想了解有关重写规则的更多信息,我认为备忘单对您很有用:http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/ 也许谷歌上有一些重写规则的例子。
Apply the rules to the path, not to the url (=leave http://localhost).
This rule will also apply to /bla/xyz and to /xyzabc. Even to /blah/xyzabc. The first parameter can be changed to forbid this:
If you want to learn more about rewriterules, I think the cheatsheet would be useful for you: http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/ And maybe google for some rewriterule examples.