Magento在我的Nginx + PHP-FPM堆栈上运行得很好,但每次我从购物车中删除产品或在产品页面上添加标签时,我都会被重定向到主页。
我知道在app / code / core / Mage / Checkout / controllers / CartController.php上用$this->_redirectReferer(Mage::getUrl('*/*'));
替换$this->_redirect('checkout/cart');
修复了购物车问题,但是标签问题呢?是否有任何规则我可以在nginx.conf上添加/改进而不是黑客攻击Magento核心?奇怪的是,这只发生在Ngix上,而不是发生在Apache上。
以下是我的配置的摘录:
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
# Pass PHP scripts on to PHP-FPM
location ~* \.php$ {
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
#expires off; ## Do not cache dynamic content
fastcgi_pass unix:/var/spool/phpfpm.sock; ## php-fpm socket
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
#fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
答案 0 :(得分:0)
回顾Magento CE 1.4.2,库存Magento CartController.php
控制器类没有任何类似的代码
$this->_redirectReferer(Mage::getUrl('/'));
我怀疑你正在处理已经被黑的系统。我下载了一个全新的安装程序并对你的CartController.php
文件进行了区分。根据您提供的信息我猜是有人替换了以下行
$this->_redirectReferer(Mage::getUrl('*/*'));
上面一行导致你的问题。