我有一个类似的url:
subdomain.domain.com/level1/level2?product_ids[]=1&product_ids=2&product_names[]=Something&product_names[]=Something+Else
我想将其重定向到一个新的域,并保留查询字符串,以便它重定向到:
subdomain.domain2.com/level1/level2?product_ids[]=1&product_ids=2&product_names[]=Something&product_names[]=Something+Else
您可以使用这个:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain1.com$ [NC]
RewriteRule ^level1/level2/?$ http://subdomain2.com%{REQUEST_URI} [NE,L,R=301]