I'm having a problem with the URL rewrites of my website where once they're generated, the 'Sort By' and filters on the category pages don't work.
They seem to 301 redirect to the parent category, ignoring the query string. For example, if I'm on /category-1/child-1/ and decide to sort by price, it requests /category-1/child-1/?product_list_order=price but 301 redirects back to /category-1/child-1/.
I've truncated the url_redirects table in the database and tested it with no generated URLs which seems to work perfectly, the 'Sort By' and filters work as they should and the query string is attached to the URL. When I generate the URLs, they break again.
I don't see anything in the logs either.
I'm on 2.3.3 on the latest patch and using OlegKoval's URL Generation module to generate the URLs via CLI (https://github.com/olegkoval/magento2-regenerate_url_rewrites) though I doubt this to be the issue.
Any help is greatly appreciated!
@jazz_singh you have two options for this.
1.You can disable the module which you are using for creating the urls and check it with defualt whether it is working fine or not.
2.You can do re-indexing once of catalog_url-rewrite and check if it works fine or re-indexing is showing any error or not.
Hi @Rahul Gupta
I had tested the filtering/sort-by functionality before installing the URL generation module and it was still not working. It has to be related to the URLs because when I wipe the url_redirects table in the database (which makes the category page structure into this: catalog/category/view/s/category-name/id/3), the sorting and filters works as they should.
When I generate the URLs, the page just 301 redirects and reloads, ignoring the filter/sort. Indexing doesn't seem to do anything either unfortunately.
@Rahul Gupta, I'm not getting any errors in the systemlog or in CLI which is why I'm out of ideas on what this could be. The generation of the URLs is breaking the filter/sortby and the pagination because the page refuses to concatenate the query strings onto the URLs, it just 301 redirects.
@jazz_singh please refer one of the two below links.