htacces rewrite condition old site to new site with querystring
- by Brandon Braner
I am not even going to pretend to fully understand how htaccess rewrite conidtions work. Ive been working on this for a while searching and searching.
I have an old wordpress site www.old-site.com and a new site www.site.com
wordpress uses query strings page_id=# to redirect to pages
on the old site page_id=2 went to a specific page but on the new site it goes the the home page
i need old-site/?page_id=2 to go to site.com/our-company here is what i am trying
RewriteCond %{HTTP_HOST} ^(www.)?old-site.com$ [NC]
RewriteCond %{QUERY_STRING} ^page_id=2$
RewriteRule ^(.*)$ http://www.site.com/our-company/ [R=301,L]
if i take out the rewrite conditio for query string it redirects all traffic from old-site.com to the our company page on the new site. where am i going wrong?
i have about 15 redirects i need to do this way.
thanks in advance