I'm dying on this htaccess:
RewriteCond %{HTTP_HOST} ^[www\.]?old\.com [NC]
RewriteCond %{REQUEST_URI} ^.+$
RewriteCond %{REQUEST_URI} !^wp-admin
RewriteCond %{REQUEST_URI} !^index
RewriteCond %{REQUEST_URI} !^subdomain
RewriteRule ^(.*)$ http://www.new.com/%{REQUEST_URI} [R=301,L]
I'm trying to redirect all traffic from www.old.com to www.new.com EXCEPT when they access:
www.old.com
old.com
old.com/wp-admin
old.com/subdomain
I still want the old site to show up and be able to administer it, but any old.com/something should be redirected to new.com/something.
That's the other thing, I couldn't get this to work by using $1 as a backreference. I had to hard-code the %{REQUEST_URI} in there instead (which worked).
The last exmaple (old.com/subdomain) is a second website entirely and I don't want to interfere with its operation either.
I've read so, so many websites and every variation makes perfect sense from a regular expression point of view and they all should work, but they don't. This is driving me crazy.