A mirror allows you to upload your content to your DreamHost server for one site (site A), but use another site’s URL (site B) on the same account to view the original site (site A).
More technically, 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. View the following article for further information:
A mirror domain can only "mirror" an existing domain 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, nor is it a "cloaking" or "domain gripping" facility.
Mirrored domains do not work well or at all with the following:
- Some CMS applications (WordPress for example) — This is because some CMS applications hard-code the URL for the site and actively rewrite the URL in the browser address bar. This causes the URL for the site to change, effectively ruining the mirrored settings. You may need to make further adjustments within the CMS if this is the case.
- DreamPress — A mirror of a DreamPress site will not work in most cases due to DreamPress caching.
If your domain's DNS records are not pointed to DreamHost and you wish to set up the domain before changing the DNS to minimize downtime, you can use a dreamhosters.com subdomain. You can read about how to set that up in the following article:
If you need to access your database while the DNS is not pointed to DreamHost, view the following article:
Setting up a subdomain can take several hours, so a faster alternative for the technically inclined is to modify your hosts file to point to your DreamHost DNS records. The following article explains how to do this:
In order to have links on a site stay within the original URL address, they must not contain the domain name. This is called using a relative link or path. For example, if mirror.example.com is the mirror for the actual site named example.com, any links on the example.com site that contain example.com will take visitors to example.com. This defeats the purpose of a mirror.
- Good (Relative): /about-us.html
- This works and keeps the user at the current URL.
- Bad (Absolute): https://www.example.com/about-us.html
- This takes the user away from mirror.example.com. With this type of linking, it makes more sense to redirect, rather than mirror.
Using relative paths is also essential if you decide to implement secure hosting on your site, since you won’t have to change any absolute links/paths from http to https.
A reason to use a redirect domain instead
In many situations, it is better to redirect a 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 URL.
The main difference is the URL you see: if you create a mirror at siteB.example.com that mirrors the actual website named siteA.example.com, when you visit siteB.example.com the address bar does not change. But, you still see the content of siteA.com.
If you create a redirect, when you visit siteB.example.com the address bar changes to siteA.example.com.
Almost all search engines blacklist your domain if they find the exact same content at another domain, which drops 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.
Creating a Mirror domain
- Open the Manage Domains page.
- Click the Add Hosting to a Domain / Sub-Domain button to create a new mirror domain.
- The Mirrored section appears in the lower part of the Manage Domains page:
- Enter the domains in the following fields:
- Create the mirror at: This is the URL that mirrors the real website. For example, if you have uploaded your content to a DreamHost domain called example.dreamhosters.com and want visitors to be able to access this at example.com, enter example.com.
- Mirror this site: From the drop-down list, select the domain to which you’ve uploaded your content. This is the domain that will be mirrored.
- Click Mirror this domain to save your settings.
You must ensure that the DNS records for the domain that is mirroring the real website points to DreamHost. You can view the following article for further information:
- The DNS may take up to a few hours to update after you save the mirror.
- Once the mirror domain is operational, visitors to the mirror domain will see the same content as the real site in which it is an alias.
- In the above example, visiting example.com shows you the content of example.dreamhosters.com.
Turning off a Mirror
To turn off a Mirror, you must change the hosting configuration to any other option such as 'Fully Hosted' or 'DNS Only'. A full list can be found on the following page:
Will the mirror domain work with https?
No. If the site is mirroring a domain with https enabled, the mirror site will throw an error when visited. For example:
Let's say you set up the site example.com to mirror https://dreamhostexample.com. When you visit example.com, the URL will change to https://example.com and attempt to mirror the content of https://dreamhostexample.com.
Since the SSL certificate is not installed on example.com, the browser throws an error letting the visitor know that the site is not secure.
For this reason, you should not mirror a site using an SSL certificate.
How long until the mirror is working?
Mirroring your site is the same as any other DNS change. This means the DNS must propagate first before you can see the changes online. In general, this shouldn't take any longer than 6 hours. You can keep track of when the new DNS records update in different locations using either of the following links: