301 Redirects for Rebranded Website

I have a convoluted situation and I want to make sure I set up the redirects properly.

Several months ago, the company rebranded itself with a different name. When they did, they registered a corresponding domain name and pointed it to the existing site. So both www.originalcompanyname.com and www.newcompanyname.com both pointed to the company website.

Now we’ve redesign the company site under the new brand. So www.newcompanyname.com will be the primary domain, and www.originalcompanyname.com will be a redirect.

I know I need to set up 301s for the www.newcompanyname.com domain so that the original site’s URLs all redirect to the URLs of the redesigned site.

I’m not sure how to set up the 301s for www.originalcompanyname.com. I want www.originalcompanyname.com to redirect to www.newcompanyname.com. Do I have to create redirects for every sub-page under that domain? Or will a single redirect from www.originalcompanyname.com to www.newcompanyname.com resolve the sub-pages as well?

Thanks!

Yup. That one. If you’re familiar with htaccess and rewrite rules, then you probably just need…

(Warning: Untested)

RewriteCond %{HTTP_HOST} =www.originalcompanyname.com [NC]
RewriteRule ^(.*)$ http://www.newcompanyname.com/$1 [R,L]

Thanks, Jeff. I’m not the expert on rewrite rules, but we have people that are.

John,

Close but it doesn’t take care of the non-www’d domain.

RewriteEngine on
RewriteCond %(HTTP_HOST} originalcompanyname\.com$ [NC]
RewriteRule .? http://www.newcompanyname.com%{REQUEST_URI} [R=301,L]

Where the first line ensures that mod_rewrite is not in comment mode, the second line matches originalcompany.name (note the escaped dot) at the end of the {HTTP_HOST} (so it will match both the www’d version and non-www’d version) and the third line simply issues a permanent redirect (R=301) without altering the originally requested URI. Remove the www. in the redirection is you care to (many webmasters are now dropping the www’d domains … as I’ve done below).

If you need more info on mod_rewrite, have a look at http://dk.co.nz/seo as that page is a lengthy tutorial with a lot of sample code with explanations.

Regards,

DK

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.