Magento有一个重定向循环 [英] Magento has a redirect loop
问题描述
我的Magento网站主页出现重定向循环错误.当我尝试打开它时,它转到我的旧服务器URL并显示错误:
My Magento web site home page has a redirect loop error. When I try to open it it goes to my old server url and gives the error:
该网页导致重定向过多.清除此站点的cookie或允许第三方cookie可能会解决此问题.如果不是,则可能是服务器配置问题,而不是您的计算机有问题.
The webpage resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
当我尝试进入管理员帐户时,它将带我到旧服务器的管理员url,没有任何错误.
When I try to go into admin it takes to me old server admin url without any error.
我下载了新数据库并将其连接到商店,它可以正常工作,但是当我将其连接到旧数据库时,它会给出相同的错误.
I down loaded the fresh data base and connected my store to that it works fine but when i connect it my old data base it give same error.
请告诉我.
推荐答案
这不是理想的解决方案,但是Magento 1.9.x出现了问题.
This isn't an ideal solution, but I was having issues with Magento 1.9.x.
设置为:Nginx Proxy & SSL Terminator => Apache Webserver
无论我如何启用SSL都会导致重定向循环.我将问题缩小到Magento,而不是Nginx配置.
No matter what I did enabling SSL caused a redirection loop. I narrowed the issue down to Magento rather than the Nginx configurations.
即使设置了正确的标头,Magento也不知道它正在接收来自Nginx的安全连接.
It was like Magento didn't know it was receiving a secure connection from Nginx even though the correct headers were set.
肮脏的解决方案是在Mage::run...
行之前,在magento根目录(即/var/www/magento
)的index.php
的最底部添加一些代码,如下所示:
The dirty solution was to add some code to the very bottom of index.php
within the magento root directory (ie. /var/www/magento
) just before the Mage::run...
line, like so:
if( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ) {
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
}
Mage::run($mageRunCode, $mageRunType);
这篇关于Magento有一个重定向循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!