Similar to our instructions on redirecting a temporary domain to a subdomain or domain that you own, you may want to redirect one domain to another. If your DNS provides this, that is the best way to do it, as it reduces the amount of complexity on the Acquia platform, and is usually going to be easier to implement than the instructions here. That said, it is possible to do it on our platform as well.
Requirements:
- The domain must be in the Acquia Cloud console, pointed ideally to the production environment.
- DNS must be pointed to your Acquia load balancer.
- Access to edit the code, specifically the
.htaccess
file in your code'sdocroot
folder.
In the instructions below, it assumes you have one domain (sourceexample.com
) and want to redirect visitors to destinationexample.com (specifically the HTTPS version).
Below the line RewriteEngine on
, add these lines:
RewriteCond %{HTTP_HOST} ^sourceexample.com$ [NC]
RewriteRule ^ https://destinationexample.com/$1 [R=301,L]
You may want to add a group for the www
subdomain as well.
Be sure to test out the rules first using an online tool first.