htaccess mod_rewrite for Opencart search page URLs

2019-08-12 22:55发布

问题:

I'm having some difficulty creating an htaccess mod_rewrite rule which would take the following URL:

http://www.mydomain.com/index.php?route=product/search&filter_name=SEARCH%20CRITERIA

and make it something more along the lines of:

http://www.mydomain.com/search/SEARCH-CRITERIA

or even

http://www.mydomain.com/search?filter_name=SEARCH%20CRITERIA

Everything I've tried seems to break the SEO-friendly URLs that are auto-generated by the Opencart framework. How can this be done?

回答1:

In Your .htaccess file place the rules directly behind the lines used to rewrite sitemap.xml and googlebase.xml and before the last general rule.

The rule could look like:

RewriteRule ^search\/(.*)$ index.php?route=product/search&filter_name=$1

- did not test it, it is just a guess.

Also showing us what have You tried would be highly appreciated.