Reputation: 4665
I am trying to redirect this structure of pages
example.com/y/T5INF08ZEdA/Miranda-Kerr-In-Hot-Water-with-Orlando-Bloom
to
example.com/s/Miranda-Kerr-In-Hot-Water-with-Orlando-Bloom
My htaccess is
RewriteRule ^s/(.*)$ index.php?videos=$1
RedirectMatch 301 ^/?y/(.*)$ http://www.example.com/s/$2 [R=301,L]
However, it redirects to
example.com/s/T5INF08ZEdA?videos=T5INF08ZEdA/Miranda-Kerr-In-Hot-Water-with-Orlando-Bloom
What is the correct way to do this redirection?
Upvotes: 0
Views: 75
Reputation: 143906
It's weird that your RedirectMatch
works at all, since there isn't a 2nd capture group ($2
should be blank).
Try sticking with just mod_rewrite, it's possible that the two directives are interferring with each other:
RewriteRule ^y/([^/]+)/(.*)$ /s/$2 [L,R=301]
RewriteRule ^s/(.*)$ index.php?videos=$1 [L]
Upvotes: 1