.htaccess - Wordpress 301 redirect with questionmark ? from one domain to new domain with different url structure -
i tried lot, looked in other posts didn't work..
i want redirect olddomain.com/?portfolio=this-is-the-title-of-the-post newdomain.com/portfolio/newtitle1/
i want redirect olddomain.com//?portfolio=10689 newdomain.com/portfolio/newtitle2/
i want check if mu redirect olddomain.com newdomain.com set correct
update: after first answers updated still not working:
rewritecond %{query_string} ^portfolio=this-is-the-title-of-the-post$ rewriterule ^ http://newsite.com/portfolio/newtitle1/? [r=301,l] rewritecond %{query_string} ^portfolio=10689$ rewriterule ^ http://newsite.com/portfolio/newtitle2/? [r=301,l] # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress # begin 301 redirects redirect 301 /index.php http://newsite.com redirect 301 /cart/ http://shop.newsite.com/cart/ redirect 301 /my-account/ http://shop.newsite.com/my-account/ redirect 301 /shop/ http://shop.newsite.com/ redirect 301 /portfolio-one-column-standard-style/ http://newsite.com/portfolio/ redirect 301 /home/blog/ http://newsite.com/blog/ redirect 301 /about/ http://newsite.com/about/ # end 301 redirects
try these 2 rules @ top of .htaccess:
# begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{query_string} portfolio=this-is-the-title-of-the-post rewriterule ^ http://newsite.com/portfolio/newtitle1/? [r=301,l] rewritecond %{query_string} portfolio=10689 rewriterule ^ http://newsite.com/portfolio/newtitle2/? [r=301,l] # begin 301 redirects rewriterule ^(index\.php)?$ http://newsite.com/ [nc,r=301,l] rewriterule ^cart/ http://shop.newsite.com/cart/ [r=301,l] rewriterule ^my-account/ http://shop.newsite.com/my-account/ [r=301,l] rewriterule ^shop/ http://shop.newsite.com/ [r=301,l] rewriterule ^portfolio-one-column-standard-style/ http://newsite.com/portfolio/ [r=301,l] rewriterule ^home/blog/ http://newsite.com/blog/ [r=301,l] rewriterule ^about/ http://newsite.com/about/ [r=301,l] # end 301 redirects rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress make sure clear browser cache before test.
Comments
Post a Comment