.htaccess - Redirect already Rewriten URL with parameter -
in order edit actual url structure. need redirect "old" links keep incoming links active.
everything working fine, doesn't work when "old" links have parameters.
here first part of .htaccess (which working) :
options +followsymlinks -multiviews rewriteengine on # rewrite "old" url "/models" "/models-pictures" rewriterule ^/?models/?$ /models-pictures [r=301,ne,l] # new redirection rewritecond %{request_uri} /models-pictures/?$ [nc] rewriterule . models.php [l]
and second part not redirecting
# rewrite "old" url "/models/[name]-pictures" "/[name]-pictures" rewriterule ^/?models/([a-z\-a-z]+)-pictures/?$ /%1-pictures [r=301,ne,l] <- not working # new redirection rewritecond %{request_uri} /([a-z\-a-z]+)-pictures/?$ [nc] rewriterule . orderby.php?model=%1 [l,qsa] # new redirection rewritecond %{request_uri} /([a-z\-a-z]+)-pictures/([a-z\-a-z]+)/?$ [nc] rewriterule . p.php?model=%1&media=%2 [l,qsa]
any ideas? thank you.
you not using correct reference in substitution string in not working rule. have %1
, should $1
.
# rewrite "old" url "/models/[name]-pictures" "/[name]-pictures" rewriterule ^/?models/([a-z\-a-z]+)-pictures/?$ /$1-pictures [r=301,ne,l]
Comments
Post a Comment