I read all the other similar questions, but could not understand how to set it up so my old pages redirect where they should.
Here is my set up:
My old site pages:
http://www.oldsite.com/blog/?p=1234
http://www.oldsite.com/blog/?p=432
http://www.oldsite.com/blog/?p=xxxx
I would like to redirect the first two like so:
http://www.oldsite.com/blog/?p=1234 -> http://www.newsite.com/somewhere/on/mysite/
http://www.oldsite.com/blog/?p=432 -> http://www.newsite.com/somewhere/else/on/mysite/
and have all other pages (123, 321, 567, 999, ...) redirect to my home page like so:
http://www.oldsite.com/blog/?p=***** -> http://www.newsite.com/
Thanks in advance!
You'll need to use mod_rewrite's ability to match against the query string, but all of the rules will have to be before any wordpress rules.
I tried @Jon Lin code, but it did not work for my WordPress site. I think the problem was that I am running WordPress... I should have included my .htaccess code, but I was not thinking that WP would be the problem...
Here is what I had to do in order to make it work: Because it is WP site you need to put the code in the WP mod_rewrite. Here is my .htaccess before the redirects:
and after:
Hope this will help other people running WP and having the same problem!