Apache Mod Rewrite 未在空 URI 上重定向
假设我有一个域 http://www.foobar.com
在此文档根目录下有两个目录: foo 和amp ; bar
我想创建一个重写规则,以便任何访问 http://www.foobar.com 的人都会被重定向到 http://www.foobar.com/foo
但它会让任何人进入所有其他真实目录独自的。
例如:
http://www.foobar.com -> http://www.foobar.com/foo
http://www.foobar.com/bar -> http://www.foobar.com/bar
我认为有这样的东西:
RewriteEngine On
RewriteRule ^$ foo/ [L]
会起作用,但它
在这里没有任何帮助?
Lets say I have a domain http://www.foobar.com
underneath this document root are two directories: foo & bar
I wanted to create a rewrite rule so that anyone just going to http://www.foobar.com is redirected to http://www.foobar.com/foo
but it would leave anyone going to all other real directories alone.
so for example:
http://www.foobar.com -> http://www.foobar.com/foo
http://www.foobar.com/bar -> http://www.foobar.com/bar
I would think having something like this:
RewriteEngine On
RewriteRule ^$ foo/ [L]
would work but it doesnt
any help here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设它在您想要的 vHost 配置中:
Assuming it's in your vHost config you want: