I'm doing htaccess to redirect http://www.d1.com/anything to http://www.d2.com/anything and it works, but I want it to NOT redirect when accessing just http://www.d1.com or http://www.d1.com/wp-admin. I'm stuck on the rewritecond rules that would make that happen.
Here's what I have so far
rewritecond %{HTTP_HOST} ^www.d1.com$ [NC]
rewriterule ^(.*)$ "http\:\/\/d2\.com\/$1" [R=301,L]
I think I need this too:
rewritecond %{HTTP_HOST} !^www.d1.com\/wp-admin$ [NC]
But I can't figure out how to make it NOT redirect if they just got to http://www.d1.com.
Ok, I think I figured it out, though I'm sure this is ugly and very wrong:
rewritecond %{HTTP_HOST} ^www.d1.com$ [NC]
rewritecond %{REQUEST_URI} ^...+ [NC]
rewritecond %{REQUEST_URI} !^/wp-admin [NC]
rewritecond %{REQUEST_URI} !^/index [NC]
rewriterule ^(.*)$ "http\:\/\/d2\.com\/$1" [R=301,L]
line one matches domain1
line 2 requires that the part that comes after http://www.d1.com must be non-0 in length
line 3 says it can't be wp-admin and line 4 says it can't be index
This redirects only if it's not just http://www.d1.com, http://www.d1.com/wp-admin, or http://www.d1.com/index.php (and it seems to work)
Nope, that didn't work well at all. It ended up causing some kind of recursive loop on my page. I think it was actually due to another redirection of some kind, but either way things went bad.