Web Hosting

Please find below our list of Web Hosting guides to help with your hosting account.

How to redirect your website to another domain

This article was posted in: Web Hosting

This article will show you how to canonicalise your website's domain. It is a good plan for Search Engine Optimisation (SEO) reasons to make sure that your website appears on the internet under a consistent domain name. e.g. if you advertise your website as mydomain.com you don't want people loading it up using www.mydomain.com and vice versa.

www or not www - that is not the question! It really doesn't matter whether you choose to be known as mydomain.com or www.mydomain.com - it's just personal preference - but more recently, there has been a trend towards apex domains - i.e. mydomain.com

Warning : If you are using a popular CMS like WordPress, Joomla, Drupal etc, please make sure that the application is already configured to work correctly with the desired fully qualified domain name - e.g. www.youdomain - if you force the webserver to redirect to something other than what your web application is configured for, you will create a recursive loop. This can be fixed easily enough, but may create problems until fixed.

cPanel's redirection tools are design to offer a basic interface to add the most common types of redirection. The redirection instructions are actually added to a .htaccess file in the virtual root directory of the domain in question.

.htaccess files can be quite long and complex, and it is impossible for cpanel to determine in all instances exactly where it should insert these redirection instructions. If you already had a complex set of instruction in such a .htaccess file, then it is possible that the following tool might prevent other parts of your websites from working correctly, until the issue is fixed. This can always be rectified, but it may be worth experimenting when your website is less busy.


Log into cPanel and click on the Redirects icon

Redirection is best configured after adding an Alias or Addon domain. Go to the Domains section in cPanel, and click on the Redirects icon.


Redirecting from a naked domain to WWW

This will open the Redirects page in cPanel. In this worked example, we will redirect any page at http://krystaldemo.co.uk to the same page at http://www.krystaldemo.co.uk

e.g. http://krystaldemo.co.uk/fudge.htm would be redirected to http://www.krystaldemo.co.uk/fudge.htm (everyone likes fudge!)


Type : Choose a 301 (permanent) redirection from the Type drop down box. 302 redirection should NOT be used for long term redirection, as the original URL will continue to be considered valid by search engines. 301 will tell Google and other search engines, this site has permanently moved.

http://: Choose the domain you would like to redirect.

Redirects to → : Enter the www version of your website's URL you wish to direct to (do not use a trailing slash).

Do Not Redirect www. : Selected

Wild Card Redirect : Ticked

Finally, click the Add button to add your redirection.


Redirecting from WWW to a naked domain

In this worked example, we will redirect any page at http://www.krystaldemo.co.uk to the same page at http://krystaldemo.co.uk

e.g. http://www.krystaldemo.co.uk/crisps.htm would be redirected to http://krystaldemo.co.uk/crisps.htm (everyone likes crisps!)


Type : Choose a 301 (permanent) redirection from the Type drop down box. 302 redirection should NOT be used for long term redirection, as the original URL will continue to be considered valid by search engines. 301 will tell Google and other search engines, this site has permanently moved.

http://www. : Choose the domain you would like to redirect.

Redirects to → : Enter the naked domain version of your website's URL you wish to redirect to (do not use a trailing slash).

www. redirection : Selected

Wild Card Redirect : Ticked

Finally, click the Add button to add your redirection.


Problems?

If your redirection doesn't work as expected, then read:

Redirection not working, or unexpected redirection occurring