We've currently moved our site to a new server but re-formatted the menu item links.
The previous ones were:
www.example.com/products/module-home/something.html
and now they are:
www.example.com/products/something.html
What I would like to do is, if a user tried to visit a page which contains module-home
in the URL, it will simply remove it and redirect them to the URL without it. Would the following RewriteRule rule be the best approach for this?
RewriteRule ^module-home/(.*)$ /$1 [L,R=301]
I know Joomla has it's own redirect manager built into the backend, however performance wise, I think modifying the .htaccess
file would be better, however correct me if I'm wrong.
Assuming your htaccess is in the root folder, you can put this rule in first position (right after RewriteEngine on
or RewriteBase
line)
RewriteRule ^([^/]+)/module-home/?(.*)$ /$1/$2 [R=301,L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With