htaccess redirects with parameter to without parameter

Hello friends, This is a post regarding htaccess redirects with parameter to without parameter. LIKE

https://www.mattssportinggoods.com/index.php?route=product/category&path=61

to

https://www.mattssportinggoods.com/fishing

I was stuck with a problem where i needed to redirect the URL on the basis of string variables.

While working with an OpenCart project, we enabled pretty permalinks which allows us to access the category pages with newly created pretty URLs.

Now all the previous URLs which was consisting variables were accessible too. As SEO point of view all these URLs need to redirect to the pretty URLs.  I searched a lot online for the htaccess redirects with parameter to without parameter. I found some which was redirecting but also consisting the parameters.

 

RewriteCond %{QUERY_STRING} path=61
RewriteRule ^index\.php$ /fishing/? [L,R=301]

 

Leave a Comment