Magento 在我的 Nginx + PHP-FPM 堆栈上运行得很好,但是每次我从购物车中删除产品或在产品页面上添加标签时,我都会被重定向到主页。
我知道用$this->_redirectReferer(Mage::getUrl('*/*'));
app $this->_redirect('checkout/cart');
/code/core/Mage/Checkout/controllers/CartController.php 替换“修复”购物车问题,但是标签一呢?有什么规则我可以在 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
}