Monday, November 7, 2016

Pointing Subdomain to another Domain through cPanel

cPanel Domain

Pointing Subdomain to another Domain

Pointing a subdomain to another domain is a challenging task for those who shift to another hosting provider. The problem is, old domain must point to the new domain properly for all sub-directories (Eg. https://sub.site1.com/article/introduction.html to https://www.site2.com/article/introduction.html). If the subdomain does not properly points to the new domain, the link may get broken. We can point a subdomain to another domain through cPanel, Zone Editor, or .htaccess file. In this tutorial, I have used cPanel version 66.0.14 to take screenshot.

cPanel Method

It is an easy method to point a subdomain to another domain. In this method, we can simply set both domains in cPanel to perform the task. In the Domains section of cPanel, click the Redirects link. In the Redirects page, enter the old subdomain and the new domain as shown in the screenshot below. Select the Wild Card Redirect box to redirect all files within a directory with the same filename in the redirected directory. But, you cannot use a Wild Card Redirect to redirect your main domain to a different directory on your site.

cPanel Redirect

The list of redirections can be viewed from the Subdomains page in the cPanel. To open the Subdomains page, click the Subdomains link present in the Domains section in the cPanel.

cPanel Subdomains

Zone Editor Method

It is a little difficult method to point a subdomain to another domain. In this method, we must specify the IP address of the new domain in “A” record in the Zone Editor. The correct IP address of the new domain must be carefully entered to point to the new domain properly. Click the + Add Record drop down menu and select Add A Record list. In the Name column, enter the old subdomain sub.site1.com and the IP address in the Record column. Press Add Record button to save the record.

cPanel Redirect

.htaccess Method

It is a difficult and complicated method to point a subdomain to another domain. In this method, we must enter the Apache handler command in the .htaccess file which is located in the www or htdocs directory, to redirect the URL. Incorrect commands may bisbehave the site's functionality. The Apache handler command for URL redirection is Redirect 301 /sub http://site2.com/$1.

0 comments :

Post a Comment