Okay, so I have two domains, let’s call them x.com and y.com.
To start off, x.com existed and was used for a personal website for many years. Then I moved all of the content from x.com to archive.x.com and started planning the new-birth of a new project. I launched the new project and eventually bought y.com and associated it to the new project.
So to summarize,
x.com was used for a personal website for many years
x.com was moved to archive.x.com
x.com was then briefly used for the launch of a new project
y.com was purchased for the primary use of the new project
Okay, now that we are all confused :D, I’ve noticed that search engine results are trying to get to pages that x.com once originally contained (yes, shame on me for not already properly redirecting these requests! – to be fair, I didn’t really care because none of these projects have money making potential at this point). But many of the searches I have seen are people looking for solutions that I documented on x.com at one point, so I feel bad by not redirecting them to the appropriate new location (I do have a conscious after all).
So now I am cleaning up my mess, and I think I did it correctly, but I would love some feedback.
First thing you should know x.com is a wordpress installation (and remains so on archive.x.com). y.com is also a wordpress installation (however, both installations use different permalink structures, so they are distinguishable – YAY!).
The first thing I did was update my .htaccess on y.com/x.com (both parked at the same location) to redirect x.com to archive.x.com
RewriteCond %{HTTP_HOST} ^x.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.x.org$
RewriteRule (.*)$ http://archive.x.org/$1 [R=301,L]
Then I noticed that a few pages that were indexed when x.com was pointing to the new project were going to archive.x.com creating a 404. So I added this to archive.x.com’s .htaccess
RewriteRule ^([-a-zA-Z0-9\\s]+/[-a-zA-Z0-9\\s]+/[0-9]+) http://y.com/$1 [R=301,L]
RewriteRule ^([0-9]+/[0-9]+/[-a-zA-Z0-9\\s]+/) http://y.com/$1 [R=301,L]
Now the only downside to this whole thing, is if a request comes pointing to a page part of the new project, but is using x.com instead of y.com, they will be redirected to archive.x.com which will in turn redirect them back to y.com (did you follow that?)
I believe I could resolve that issue by adding the same re-write rules I have on archive.x.com to x.com/y.com’s .htaccess (again since they are parked at the same location)
I’m thinking something like the below would be the final .htaccess changes for x.com/y.com
RewriteCond %{HTTP_HOST} ^x.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.x.org$
RewriteRule ^([-a-zA-Z0-9\\s]+/[-a-zA-Z0-9\\s]+/[0-9]+) http://y.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^x.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.x.org$
RewriteRule ^([0-9]+/[0-9]+/[-a-zA-Z0-9\\s]+/) http://y.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^x.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.x.org$
RewriteRule (.*)$ http://archive.x.org/$1 [R=301,L]
Does this look right to everyone else? Or did I create a fundamental blunder that I should be chastised for (yes, I talking to you @dklynn ; :p)?