2017-10-06 81 views
0

使用htaccess我如何301重定向以下?使用通配符重定向查询字符串后

domain.com/index.php?r=apiv2/*app.domain.com/index.php?r=apiv2/*

哪里*是什么

通配符这是迄今为止我尝试:提前

RewriteCond %{QUERY_STRING} r=apiv2(.*) 
RewriteRule ^index\.php$ https://app.domain.com/index.php?r=apiv2/$1 [L,R=301] 

谢谢!

回答

0

您可以使用:

RewriteCond %{QUERY_STRING} r=apiv2(.*) 
RewriteRule ^index\.php$ https://app.domain.com/index.php?r=apiv2%1 [L,R=301] 

%1反向引用最后匹配的RewriteCond模式