8

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.

1 Answer 1

7

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]
Sign up to request clarification or add additional context in comments.

1 Comment

Had a little bit of an issue trying to understand the logic. But got it after all. Thanks works great @Justin lurman

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.