Multiple domains, all pointing to your site

We've discussed having multiple domains before all pointing to your site, but I guess I wasn't listening Cheesy Grin 

When I first started my website I registered hi-photo.net as the domain because I thought that short was all that really mattered.  It's hard to fit a long domain name on a business card anyway.

But after a while I got tired of having to spell out my domain name to people (H, I, dash, photo, dot, net).  Plus I got a lot of "HI photo, that's so cute."  Cute's good, but not when nobody notices that the abbreviation is an abbreviation. 

So what I did was register HeavenlyImagesPhotography.com, .net, & .org and HeavenlyImagesPhoto.com, .net, & .org and parked them all on my cPanel account. 

So that's all well and good, but Google (and the other search engines) see www.hi-photo.net, www.heavenlyimagesphotography.com, and heavenlyimagesphotography.com as different sites.  So I had to pick one and have all the other redirect to my pick.  I figured the longest one, HeavenlyImagesPhotography.com, was the best choice because it's a dot-com and has the full word "photography" in it.  I've been forgoing the www. on the front of most of the sites I've done recently, this site included, so I want everything to redirect to heavenlyimagesphotography.com.

Once the domains are parked it's pretty easy to do if you're using a Linux server.  You're going to create a file named .htaccess and enter the code below into it.  The file needs to be all lower cased and start with a period, which Windows won't let you do.  What I do to get around that is give it a different name and rename it through FileZilla after I upload it.

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

What's happening is that the server checks to see if the domain name matches example.com, and if it doesn't then it redirects to example.com keeping anything after the domain name (the $1 part).

You'll need to change example.com to whatever your primary domain name is and make sure the line starting with RewriteCond has a \ before any periods.  Upload the file and you should be set to go.  You do want to make sure you test it first. 
Logged