我想重定向
http://example.com/report?domain=dollarshaveclub.com
到
http://www.semrush.com/info/dollarshaveclub.com+%28by+organic%29
我试过了:
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^?domain=$
RewriteRule ^report$ http://www.semrush.com/info/$1+%28by+organic%29 [R=301,L]
但我没有到达任何地方......我接下来可以尝试什么?
答案 0 :(得分:1)
您必须删除R=301,
部分。
这对我有用:
RewriteEngine On
RewriteRule ^report$ http://www.semrush.com/info/$1+%28by+organic%29 [NC]
答案 1 :(得分:0)
最终找到解决方案:
RewriteCond %{QUERY_STRING} ^domain=(.*)
RewriteRule ^report(.*) http://www.semrush.com/info/%1+(by+organic)? [R=301,L]