Question

Is it possible to make a website http://<DOMAIN_1> automatically redirect to a website http://<DOMAIN_2> just by creating CNAME record?

Answer

It would be possible to make a website http://<DOMAIN_1>/ redirect to a website http://<DOMAIN_2>/ only by means of CNAME record if the website http://<DOMAIN_2> is running on exclusive IP address.

In case of shared IP address it is not possible to make a website http://<DOMAIN_1>/ redirect to a website http://<DOMAIN_2>/ just by means of DNS due to web server design. In two words - the 'Host' header will not allow to achieve the goal in case website http:/// is using shared IP address (name-based hosting).

For example, refer to the following Apache documentation for more details: Name-based Virtual Host Support.

Let's say you want to set up CNAME record for <DOMAIN_1> to point to <DOMAIN_2>.

When someone opens the website http://<DOMAIN_1>/ in their browser the following actions will happen:

  1. The <DOMAIN_1> is the alias for the <DOMAIN_2> so HTTP request will be sent to the IP address of the <DOMAIN_2>.
  2. IP address of the website http://<DOMAIN_2> is shared IP (which means that many sites share it and web server uses the 'Host' header to process incoming HTTP requests).
  3. HTTP request will contain the 'Host' header of the website http://<DOMAIN_1> because it was opened in browser.
  4. Web server will accept HTTP request as request for the website http://<DOMAIN_1>/ and will check own configuration for Virtual Host with the 'Host' header of the website http://<DOMAIN_1>.
  5. Web server will not find any Virtual Host for it and will display the default domain page (Web server only knows about the website http://<DOMAIN_2>).

To correctly redirect website you can use the following ways:

  1. Assign the 'Standard Forwarding Domain Parking' hosting type to the <DOMAIN_1> in OA and forward it to the website http://<DOMAIN_2>/.

  2. Assign the 'Frame Forwarding Domain Parking' hosting type to the <DOMAIN_1> in OA and forward it to the website http://<DOMAIN_2>/.

  3. Use the 'Domain Aliases' feature in POA to create domain alias correctly.

    Note: in POA 5.4 the 'Domain Aliases' feature works only in the Linux Shared Hosting Standard service and does not work in the Linux Shared Hosting NG service. In POA 5.5 it should work in both services.

  4. Assign web hosting to the <DOMAIN_1> and use the .htaccess or some custom HTML/PHP code to redirect to the website http://<DOMAIN_2>/.

Internal content