I am having a strange issue with my product filter (layered navigation) not working, I have narrowed this down to the URL paramaters being lost because of a 301 redirect.

If I go to the URL... http://domain.local/styles/?attribute_style=258

I would expect to land on a category page with a result filtered by attribute style. This does't happen, the products aren't being filtered. This seems to be because the above URL goes to a 301 redirect and forwards me to the URL... http://domain.local/styles/ without the query string. 301 Redirect I am pretty sure this is related to a configuration setting as I'm sure it was fine before I imported a pre-existing database.

Does anyone have any idea what is causing this and how I can resolve it?

  • can you check your .htaccess file? I guess the reason can be found there. Maybe a rewrite that expects a "/" at the end of the URL, and removes the query params? Replace the .htaccess by the Magento default file to test this. – simonthesorcerer Oct 17 '19 at 15:42
  • I have replaced the .htaccess with the .htaccess.sample that comes with Magento but it is still doing the 301 redirect. – NetStorm Oct 18 '19 at 8:38

Besides clearing your rewriter table I guess you should clear your browser cache.

  • Yes browser cache is a good idea. Or have Dev-Tools open and check "Disable cache" in the network tab. Or simply do http://domain.local/styles/?attribute_style=258 for a request that won't be cached at all. – simonthesorcerer Oct 18 '19 at 9:43

This happened to be a combination between having the trailing slash enabled and a core Magento bug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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