Rob
Rob

Reputation: 21

.htaccess Redict 301: Stop Redirection for Subfolders

Hello and thank you for being there,

I'm trying to redirect the page www.mydomain.com/hello/page to www.mydomain.com/mypage

I'm using this rule

Redirect 301 /hello/page http://www.mydomain.com/mypage

It works fine, but the problem comes now with pages like www.mydomain.com/hello/page/page2 They are automatically redirected to www.mydomain.com/mypage/page2

Is there a way I can redirect all pages that go to /hello/page/(whatever) to www.mydomain.com/mypage instead of www.mydomain.com/mypage/(whatever)

Thank you very much!

Upvotes: 1

Views: 384

Answers (1)

Rob
Rob

Reputation: 21

So I found a way to do it in case someone runs into the same question:

redirectMatch 301 ^/hello/page/(.*)$ http://www.mydomain.com/mypage

Hope it help.

Upvotes: 1

Related Questions