我希望将example.com/foo/[some string]FOOBAR
重定向到subdomain.example.com/[some string]Foobar
我在我的.htaccess文件中使用
RedirectMatch 301 /foo/(^.*$)FOOBAR http://subdomain.example.com/$1Foobar
哪个不起作用,只会导致404
有什么建议吗?
答案 0 :(得分:2)
最有可能的原因是你有以下规则:
RedirectMatch 301 /foo/(^.*$)FOOBAR http://subdomain.example.com/$1Foobar
在哪里,您已将$
放在括号内!请尝试以下方法:
RedirectMatch 301 /foo/(^.*)FOOBAR$ http://subdomain.example.com/$1Foobar