Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.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
Redirect 基于域名的重定向和重写 我需要做的是:_Redirect_Nginx_Magento 1.7 - Fatal编程技术网

Redirect 基于域名的重定向和重写 我需要做的是:

Redirect 基于域名的重定向和重写 我需要做的是:,redirect,nginx,magento-1.7,Redirect,Nginx,Magento 1.7,我需要根据请求中的域名进行重定向,一旦重定向发生,我需要重写url,以便用户只能在url中看到该域名 细节 我的网站目前拥有域名example.com,我还有第二个域名distribute.com,我需要将流量重定向到特定的url。此url将切换到另一个存储视图:example.com?\uuuuuu store=differentstore 切换工作正常,但我需要弄清楚如何在nginx中设置一个规则,该规则将监视different.com,然后重定向到上述url,但从那时起,将url重写到di

我需要根据请求中的域名进行重定向,一旦重定向发生,我需要重写url,以便用户只能在url中看到该域名

细节 我的网站目前拥有域名
example.com
,我还有第二个域名
distribute.com
,我需要将流量重定向到特定的url。此url将切换到另一个存储视图:
example.com?\uuuuuu store=differentstore

切换工作正常,但我需要弄清楚如何在nginx中设置一个规则,该规则将监视
different.com
,然后重定向到上述url,但从那时起,将url重写到
different.com
,以便那些用户永远不会看到
example.com

我唯一需要
?\uuuu store=differentstore
的时候是在初始条目上,主机是
different.com
。从那时起,用户将无法看到默认视图(例如.com),除非他们浏览到
example.com

我所尝试的: 这是我迄今为止尝试过的,但不起作用:

server {
   listen 80;
   server_name www.different.com different.com;
   return 301 http://www.example.com?___store=different;

   if ($http_host != "www.example.com" && $http_host != "example.com") {
             rewrite ^ http://different.com$request_uri;
}
细节
  • LEMP堆栈
  • Magento 1.7