Merging two sites into one, how to redirect from the domain that's going away?

Posted by bikeboy389 on Pro Webmasters See other posts from Pro Webmasters or by bikeboy389
Published on 2011-04-29T20:10:35Z Indexed on 2011/06/30 0:30 UTC
Read the original article Hit count: 165

Filed under:

I haven't been able to find any existing questions that cover my exact issue, so here goes:

My client wants her two sites (domain1.com and domain2.com) rolled into a single, new site under domain1.com. Once the site is ready on domain1.com, DNS for domain2.com would be pointed at the same server as domain1.com.

I know how to do an htaccess rewrite rule that would make all domain2.com traffic map to a specific single page or directory within domain1.com. But that's not what the client wants.

What she wants is for a bunch of specific pages on domain2.com to map to specific new pages on domain1.com.

For example: domain2.com/index.php?pageid=58 GOES TO domain1.com/2011/04/somearticle domain2.com/index.php?pageid=92 GOES TO domain1.com/2011/03/differentname etc.

I could put a bunch of 301 redirects in the htaccess on domain1.com, which would work fine. The problem is, the client doesn't want/need specific redirects for ALL the domain2.com pages, and if I just do 301 redirects, anybody who comes looking for a domain2.com page that I haven't built a specific redirect for will get a 404 error.

So I need to use 301 redirects for some traffic, and a rewrite rule for any traffic that's not covered in the 301 redirects.

How do I do sort of a blending of a rewrite rule and 301 redirects, all in the htaccess file for domain1.com? Is this possible? Is it as simple as putting the 301 redirects in the htaccess file first, then doing the rewrite rule? I'm guessing not.

© Pro Webmasters or respective owner

Related posts about htaccess