superscral
superscral

Reputation: 480

RedirectMatch 301 issue

I have an issue in my RedirectMatch 301 rule.

I want to redirect all urls like theses:

http://www.toto.com/lang/fr/tutu/salut-les-gens
http://www.toto.com/lang/fr/tutu/trop-bien
http://www.toto.com/lang/fr/tutu/gg-a-toi

to:

http://www.toto.com/blog/tutu/salut-les-gens
http://www.toto.com/blog/tutu/trop-bien
http://www.toto.com/blog/tutu/gg-a-toi

I have set this rules:

RedirectMatch 301 ^/lang/fr/tutu/.* /blog/tutu/$1

but it's redirections to http://www.toto.com/blog/tutu and not http://www.toto.com/blog/tutu/salut-les-gens

Thanks !

Upvotes: 1

Views: 987

Answers (1)

regilero
regilero

Reputation: 30496

You need parentheses to capture content and reuse it in a variable. And you should first try your rules with 302 codes, and not 301. So that if you make any mistake you do not have to close your browser to re-test the new rule (with 301 the browser is not requesting anymore the web server after the first answer).

RedirectMatch 302 ^/lang/fr/tutu/(.*) /blog/tutu/$1

Upvotes: 2

Related Questions