What is the correct way to perform a 301 redirect in .htaccess for URLs with a parameter? -
i simple 301 direct on old urls have parameters them.
e.g.
redirect 301 /display.php?id=2 http://www.url.com.au/about/ redirect 301 /display.php?id=4 http://www.url.com.au/news/
my experience .htaccess limited. simplest , correct way enable above redirects work.
this should work given don't have other rules may interfere one:
rewritecond %{query_string} ^id=2$ rewriterule ^display.php$ /about/ [r=301,l] rewritecond %{query_string} ^id=4$ rewriterule ^display.php$ /news/ [r=301,l]
if domain not same domain may include full qualified domain in:
rewritecond %{query_string} ^id=2$ rewriterule ^display.php$ http://www.url.com.au/about/ [r=301,l]
Comments
Post a Comment