【发布时间】:2015-06-03 16:46:59
【问题描述】:
我可以添加什么规则来获得以下结果?
我想将包含某个目录的任何搜索重定向到主页。例如,当有人尝试...
test.com/example
...or...
test.com/example/something
...they end up at...
test.com
我尝试过的大多数东西都可以正常工作,但总是在重定向后将目标目录之后的内容附加到域中,例如...
test.com/example/something
...leads to...
test.com/something
这不是我想要的。谢谢
我尝试过的代码...
RewriteRule ^example/(.*)$ http://www.test.com [L,R=301]
and
Redirect 301 /example http://www.test.com
更新 这似乎可以解决它...
RedirectMatch 301 ^/example/ /
Redirect 301 /example http://www.test.com/
谢谢!
【问题讨论】:
-
发布您正在使用的实际代码。