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

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -