Domain redirection in .htaccess

Since the domain mapping plugin is not able to handle all the situations we need I'm going to remove it and just use domain aliases (as per Rackspace's definition) and .htaccess redirection to take care of everything we need to. I've got most of it working, but for some reason I can't figure out (and neither can Rackspace support, although it's not their forte) the non-www version of the redirection domain is not working. So I'm hoping there is a mod_rewrite guru here who can help.

Here's my situation:
- WP Multisite installation using directory structure.
- Each blog will have 2 unique domain names that point to it (redirect to it)
- One of these domain names (the .us domain) will be the main domain we want to optimize SEO for

Here's an example:
Blog's real address is: http://domain.us/blogA. Redirect rules go into this site's .htaccess file.

Unique domain http://www.blogA.us set up as alias pointing to http://www.domain.us, this domain becomes the main domain all SEO efforts are directed towards. Redirection must keep http://www.blogA.us in the browser address bar.

Unique domain http://blogA.com set up to catch everyone who automatically types .com after a name. Should redirect to http://www.blogA.us so that browser address bar changes to http://www.blogA.us as 301 redirect.

Currently I've only got my test case set up using one domain got it working for http://www.blogA.us. But when I try it with http://blogA.us it's not working. Instead it redirects to http://www.domain.us (where the alias is pointing). Before I go any further and complicate things by adding in the redirection for the http://www.blogA.com and http://blogA.com domain redirects I want to get this working. Ultimately I do need the code for the whole scenario to work with both .us and .com names and both www and non-www versions of each domain name.

Whew. So... mod_rewrite gurus, help please!

  • guildmeister
    • Design Lord, Child of Thor

    Thanks guys.
    @masonjames - the domains are registered with Rackspace, our host. They don't seem to have that kind of redirect service available, they have been pointing me toward using the .htaccess redirects.

    @Aaron - we use the domain mapping plugin at the moment, for the .us version of the domain name (the main domain name), but it's not working the way we want it to. So that's not a solution for us.When I add the .com domain name as well it will default to the .com domain, and change any URL using the .us domain name to the .com instead, which is not what we want. So if I have to use redirects for all the .com domains, I would prefer to use them for the .us domains also. Doing this with redirects also gives us the option of setting up email addresses on all those domains. Currently, the way we have to set up the domains that we use in the domain mapping plugin does not give us the option of setting up an email address on that domain. This is minor compared to the issue with the way the domain mapping plugin does changes everything to the .com version of the domain though.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.