以下域只是示例域。 我想将 mydomain.com/test/(通配符)重定向到 google.com/dl(通配符)
我正在使用此代码
RewriteEngine on
RedirectMatch 301 ^/test/.*$ https://google.com/dl
但是当我访问 https://example.com/test/hi 时它重定向到 https://google.com/dl ,而不是 https://google.com/dl/hi
我该怎么做?谢谢
答案 0 :(得分:2)
你能不能试试下面的,用显示的样本写的。在测试您的网址之前,请务必清除浏览器缓存。
RewriteEngine on
RewriteRule ^test/(.*)/?$ https://google.com/dl/$1 [R=301,NC,L]
答案 1 :(得分:-1)
你可以试试,你会找到100%的解决方案,你必须在项目的根文件夹.htaccess文件中添加以下3行
RewriteEngine on
RewriteBase /
RewriteRule (.*) http://www.new-domain.com/$1 [R=301,L][/php]