As stated, adding a product to the compare list redirects to the home page but I'd like it not to redirect at all. The product is successfully added to the list, the redirect is the only problem.

Edit: Same happens when "Clear"-ing the list. Interestingly enough, if you press "Clear" as a logged-in user at your dashboard, it correctly stays on the dashboard instead of redirecting to the homepage.

Edit #2: I figured it out, look below for the answer.

2 Answers 2


I accidentally fixed this problem, it was related to Magento adding .../index.php/... to everything after the base-url. The site worked but it looked weird so I removed it:

"On the 'Web' page, navigate to 'Search Engine Optimisation' tab and select 'YES' underneath the 'Use Web Server Rewrites' option."


"Now go to the root of your Magento website folder and use this code for your .htaccess:"

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

From this thread helped me fix the index.php issue and that fixed the redirection issue!


Seems like your server doesn't return the 'HTTP_REFERER' variable. This issue can be triggered by 3d party cache on the server or some of its settings.

I recommend you to check /app/code/core/Mage/Catalog/controllers/Product/CompareController.php and its addAction() method.

At the end of the method, there's a function called:


It leads to this function:


In the /app/code/core/Mage/Core/Controller/Varien/Action.php file check what this code returns:

$refererUrl = $this->getRequest()->getServer('HTTP_REFERER');

And let us know the result.

  • What's the best way to check what it returns?
    – Aardi
    Mar 16, 2016 at 7:04
  • Just enable logging under System > Configuration > Advanced > Developer > Log Settings and add this: Mage::log($this->getRequest()->getServer('HTTP_REFERER'),null,'test.log'); to the code
    – Mageworx
    Mar 16, 2016 at 9:22
  • Apparently I accidentally fixed it, it was because Magento was adding .../index.php/... to everything and an hour or two ago I read up on how to prohibit that. Thanks for the help!
    – Aardi
    Mar 16, 2016 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.