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
Post a Comment