1

Every few hours my live Magento 1.7.0.2 installation is caching the wrong link URLs for the category navigation menu.

Sometimes they use the wrong form of the domain (without the www and adding an SID get var) in which case users get endlessly redirected to the homepage or, worse, they sometimes redirect to http://localhost! The same problem also occurs when accessing the backend. Clearing the cache resolves the issue temporarily but it normally resurfaces after a 1-2 hours. Disabling the cache is a temporary fix but obviously not ideal for a production environment.

I’ve never seen this before, any suggestions?

Thanks in advance

3
  • Are you using a 3th party caching extension or the magento default extension? Sep 7, 2013 at 5:34
  • Default magento caching - just grepped through the cache files and the only mention of localhost in the config cache is as SMTP server but yet it is still building pages with localhost links?!
    – ACGray
    Sep 7, 2013 at 16:31
  • 1
    You may also try to make a full dump of your DB and also grep it for localhost.
    – user487772
    Sep 7, 2013 at 20:38

1 Answer 1

2

Are you using {{base_url}} as your site url in your configuration? If so, that means that users can access the site on any URL that your webserver's configured to use for that vhost. If someone happens to hit the site on localhost at the point when the cache is regenerated, that could be cached.

This is in System -> Configuration -> Web - you should always set the Base URLs explicitly to a real URL (and don't forget the final / on the URLs)

This is a security issue if you are the default vhost on your server too - see Why is using {{base_url}} in a production server not recommended?

Your Answer

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

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