Mirror Domain

A mirror domain is a server alias on the DreamHost server that allows you to access the same DreamHost site content under more than one address. For example, you can have both a .com and a .net site that share the same site content, or access your site live before your domain is set up, using a dreamhosters.com subdomain.

A mirror domain can only "mirror" an existing account at DreamHost, as it is merely a server alias. A mirror domain is a "mirror" only in terms of address aliasing; it is not a physical mirror and there is no content duplication involved. Neither is it a "cloaking" or "domain gripping" facility: for this, you want a Cloaked Domain.

Creating a mirror domain
Mirror domains are created via the Manage Domains area of the Web Panel. Click Add New Domain / Sub-Domain to create a new mirror domain: it is the third item on this page.

Under Domain that mirrors, enter the name of the domain name that will be acting as the mirror. For example, if you have a DreamHost account and domain called foo.com and want visitors to be able to access this at foo.net as well, enter "foo.net" as the domain that mirrors.

Next, select an existing DreamHost account that contains all the content that will appear at this new address. This is given as a drop-down list of available DreamHost accounts. In the example case, you should see "foo.com" as your existing account.

You are now ready to create the mirror. You will of course need to ensure that the DNS records for the domain point at DreamHost's nameservers, of ns1 to ns3.dreamhost.com.

Once the mirror domain is operational, visitors to the mirror domain will see the same content as the account of which it is an alias.

Dreamhosters.com subdomains
The time taken to set up a domain name and have the DNS records propagate around the globe can be lengthy. Until this process is complete, you will not be able to access your new site. One workaround to this is to create a dreamhosters.com subdomain which will only take a few hours to become operational.

Creation of these is a one-step process: simply enter your desired subdomain name under Domain that mirrors, e.g. foo.dreamhosters.com, and DreamHost will create it for you.

However, subdomains of your proper domain, e.g. mysql.foo.com for MySQL access, will not work automatically under the subdomain. See accessing your database before DNS changes for how to set this up.

Setting up a subdomain can take several hours, so a faster alternative for the technically inclined is to use the DreamHosters name servers to obtain the IP address for your domain and each subdomain (mysql.foo.com will not have the same IP as www.foo.com) and place them into your hosts file.

Internal Linking
It should be borne in mind that in order to have a site stay within the original address, links on the site must not contain the domain name. For example, if example-mirror.com aliases example.com, any links on the example.com site that contain "example.com" will take visitors to example-mirror.com back to example.com.

Keep internal linking technique in mind only if a domain is going to be mirrored.


 * Good: /about-us.html
 * This will work and keep the user at the current domain.


 * Bad: http://www.example.com/about-us.html
 * This will take the user away from example-mirror.com. With this type of linking, it would make more sense to redirect, rather than mirror.

If The Alias is for a Non Dreamhost hosted Domain
Example: forum.siteone.com (not hosted at Dreamhost) should take you to siteoneforum.sitetwo.com (hosted at Dreamhost)

If you are trying to add an alias for a domain that is not hosted at dreamhost, you will need to go click the 'Add New Domain/Sub Domain' and add siteone.com.

Once you've added it, go back to that same URL and click the 'delete' button located next to that domain under the 'Web Hosting' column to remove the hosting service for it. Then go ahead and set up the forum sub domain for siteone.com by clicking the 'Add New Domain/Sub Domain' button again.

Scroll down to the 'Mirrored' section and select siteoneforum.sitetwo.com from the drop-down list (this must already be created). Click the button to save the change and you'll be all set.

Reason To Use Redirect Domains Instead
In many situations it is better to use a Redirect Domain if you want the same content accessible from different domains. This is where visitors to any alternative domains are automatically redirected to your primary domain, instead of seeing identical content at the alternative domains.

Almost all search engines will blacklist your domain if they find the exact same content at another domain, which will drop your site very far down in their search results. If you want the same content accessible from different URLs, it is best to use a Redirect Domain.

Exception:
An example of when mirroring a domain doesn't present a duplicate-content issue would be when unique content is dynamically generated/included based on the domain that's requested.

In its simplest form, consider this PHP example:  

You can expand on that to include different templates, image directories, etc... based on the domain that's requested.

Another Trick To Avoid Penalties
Or maybe you're just really set on using two domains for the same content, but you also care about duplicate content issues.

These examples assume that your domain is example.com, which is the one you care about seeing in the search results.

Option A uses the .htaccess file, and a second robots.txt file called robots2.txt, which includes the following:

User-agent: * Disallow: /

Your regular robots.txt file should contain this, unless you have other entries you wish to keep:

User-agent: * Disallow:

Then, put this in your .htaccess file, replacing example.com with your domain name:

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/robots.txt$ RewriteCond %{HTTP_HOST} !^.*example\.com$ RewriteRule. /robots2.txt [L]

You can test it by typing in example.com/robots.txt, which shouldn't disallow anything. Then, type in your-mirror-domain.com/robots.txt, which should show robots2.txt.

Note for paranoid Googlers: This is not cloaking, as all user-agents are shown the same thing.

Option B uses PHP code that should either be placed in a common header file, or included in each page. This simply adds the robots meta-tag for the mirrors.

Hardcoded Title That Doesn't Change '; } ?> Content goes here.

This could also be accomplished by parsing text files (.txt) with PHP and adding this to the robots.txt file.



Email
See Email Aliases: Mail Mirror if you are looking to mirror the email setup of another domain. This technique does not depend on how the web services for the domain are configured, as long as both domains are hosted by Dreamhost.

Related Articles

 * Redirect Domain