regex - How can I do a 301 redirect? -


i have code in htaccess

rewriterule ^/?watch-([a-za-z0-9\-]+)-tvshow-season-([0-9]+)-episode-([0-9]+)-online-free.html$ index.php?menu=episode&perma=$1&season=$2&episode=$3&lang=en [l] 

the old 1

rewriterule ^/?show/([a-za-z0-9\-]+)/season/([0-9]+)/episode/([0-9]+)$ index.php?menu=episode&perma=$1&season=$2&episode=$3&lang=en [l] 

so want old redirect new

redirect 301  /?show/([a-za-z0-9\-]+)/season/([0-9]+)/episode/([0-9]+)  /?watch-([a-za-z0-9\-]+)-tvshow-season-([0-9]+)-episode-([0-9]+)-online-free.html 

redirect directive doesn't use regex. use redirectmatch instead , have use back-reference in target url:

redirectmatch 301 ^/show/([a-za-z0-9-]+)/season/([0-9]+)/episode/([0-9]+) /watch-$1-tvshow-season-$2-episode-$3-online-free.html 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -