我希望将 example.com/foo/[some string]FOOBAR
重定向到 subdomain.example.com/[some string]Foobar
我在我的 .htaccess 文件中使用
RedirectMatch 301/foo/(^.*$)FOOBAR http://subdomain.example.com/$1Foobar
这不起作用,只会导致 404
有什么建议吗?
最佳答案
这很可能是因为您有以下规则:
RedirectMatch 301 /foo/(^.*$)FOOBAR http://subdomain.example.com/$1Foobar
其中,您已将 $
放在括号内!尝试以下方法:
RedirectMatch 301 /foo/(^.*)FOOBAR$ http://subdomain.example.com/$1Foobar
关于apache - .htaccess 重定向 更改 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10163391/