Forum Moderators: phranque
I have read a few articles about 301-redirects...would this apply? I want this to be as clean, proper, and search-engine friendly as possible. Any suggestions? Thank you.
What I've done for this issue is to point both domains to the same server space. This means that requests for domain1.com and domain2.com would both result in the same page appearing in the browser. My host allows me to specify the domains that point to my account. If you have a dedicated server, then you obviously control what goes where.
Once you have both domain names pointing to the same space, you can use an .htaccess file that is going to look something like this:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.alternatedomain\.com
RewriteRule ^(.*)$ [maindomain.com...] [R=301,L]
This code says if a request comes in for your alternate domain, do a permanent redirect to yourpage.htm on your main domain.
Note that the first two lines may or may not be required, depending on how Apache is set up.
If you are using an IIS server, you can use the IIS manager to do the same thing by creating a new web site, and then indicating that the content can be found by a permanent redirection to an URL. (If you are using an IIS host without access to IIS manager, you will have to plead with your host to get this done).
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.alternatedomain\.com [NC]
RewriteRule ^(.*)$ [maindomain.com...] [R=301,L]
Or, on an IIS server, you would do this
Let's suppose that you have a web site [example1.com...]
and you want [example2.com...] to do a 301 redirect to
the [example1.com...] site.1. Set up the example2.com web site in Internet Services
Manager and enter into the Properties.
2. In the Home Directory tab, change the option button "When
connecting to this resource the content should come from" to
"A redirection to a URL".
3. Specify the URL as [example1.com$S$Q...]
4. Check the checkbox that says "A permanent redirection for
this resource."Note that in Step #4 variables are needed
$S will preserve the file path, and $Q will preserve any query string