1-866-277-9958

.htaccess

How To 301 Redirect Multiple Domains Into One Domain

Problem: 

If you need to do a 301 redirect between multiple domain names, and force all domains to direct to the "www", use the following code in your .htaccess file.

RewriteCond %{HTTP_Host} ^(www\.)?secondary-domain1\.com$ [NC]
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [L,R=301]

RewriteCond %{HTTP_Host} ^(www\.)?secondary-domain2\.com$ [NC]
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [L,R=301]

RewriteCond %{HTTP_Host} ^maindomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [L,R=301]

And that's how you would do a 301 redirect between multiple domain names, and force the "www" version of your main domain.  The code above is for a .htaccess file on an apache server.

Simple .htaccess Hack for Drupal SEO

On a fresh install of Drupal, you'll encounter issues with how your website's domain can be accessed. Out of the box, you'll be able to access your site both with and without the "www" prefix. This can be a problem for Drupal SEO, as the potential exists for search engines to think your website contains duplicate content, even when it doesn't. This isn't a fix that will lead to dramatic improvements, but it's a good SEO best practice for Drupal sites.

Step 1: Find Your .htaccess File


Get Drupal help when you need it most! Find hundreds of great tutorials. Track, rate, comment and more. Create Account
Syndicate content
Syndicate content

©1999 - 2011 LevelTen Interactive - Dallas, TX