Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 将流量从www.重定向到存储。_Apache_.htaccess_Redirect - Fatal编程技术网

Apache 将流量从www.重定向到存储。

Apache 将流量从www.重定向到存储。,apache,.htaccess,redirect,Apache,.htaccess,Redirect,我正在尝试对.htaccess进行更改,以重定向形式为www.mysite.com/products/product\u id或www.mysite.com/items/item\u id的流量到store.mysite.com/products/product\u id或store.mysite.com/items/item\u id进行重定向 mysite.com/products/* mysite.com/items/* 到 store.mysite.com/products/* s

我正在尝试对.htaccess进行更改,以重定向形式为
www.mysite.com/products/product\u id
www.mysite.com/items/item\u id
的流量到
store.mysite.com/products/product\u id
store.mysite.com/items/item\u id
进行重定向

  • mysite.com/products/*
  • mysite.com/items/*

  • store.mysite.com/products/*
  • store.mysite.com/items/*
您可以使用以下规则:

RewriteEngine on


RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$
RewriteCond %{REQUEST_URI} ^/(products|items) [NC]
RewriteRule ^(.+)$ http://store.mysite.com/$1 [NC,L,QSA,R]