Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^my\.newsite\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/$.*$ [NC]
RewriteCond %{REQUEST_URI} !^/_.*$ [NC]
RewriteCond %{REQUEST_URI} !^/folder1.*$ [NC]
RewriteCond %{REQUEST_URI} !^/folder2.*$ [NC]
RewriteCond %{REQUEST_URI} !^/folder3.*$ [NC]
RewriteCond %{REQUEST_URI} !^/folder4.*$ [NC]
RewriteCond %{REQUEST_URI} !^/folder5.*$ [NC]
RewriteRule (.*)$ [old.site.net$1...] [R,L]
I am moving my site to a new one. However I have only a few things moved over. So when you go to the old domain I want it to redirect all to the old.site.net. However I created folders for the things that are already moved. These exceptions work but I also need to exclude
/?locale=en_US
when I add the query_string it breaks the /root redirect. Any help would be great.
RewriteCond %{HTTP_HOST} ^my\.newsite\.com [NC]
RewriteCond %{QUERY_STRING} !locale=en_US [NC]
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !^/_
RewriteCond %{REQUEST_URI} !^/folder1/ [NC]
RewriteCond %{REQUEST_URI} !^/folder2/ [NC]
RewriteCond %{REQUEST_URI} !^/folder3/ [NC]
RewriteCond %{REQUEST_URI} !^/folder4/ [NC]
RewriteCond %{REQUEST_URI} !^/folder5/ [NC]
RewriteRule ^/(.*) http://old.site.net/$1 [R=302,L]
You'd actually be far better off redirecting from the old site to the new with a 301 redirect instead of redirecting from the new site to the old with a 302. Doing so will confuse the search engines, and may delay their recognition of your new site when/as you remove these 302 redirects.
Jim
[edited by: jdMorgan at 11:43 pm (utc) on Mar. 10, 2009]
There's no magic to this... Something just isn't correctly-coded, or it's a correct code implementation of an incorrect requirement.
Jim
As it stands, the rule will not execute if the query string contains "locale=en_US" regardless of upper/lowercase, and regardless of the requested URL to which that query string is appended.
Jim