How to redirect your website to another domain

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.

The cPanel Redirects tool is found in the DOMAINS section.

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 all traffic from non-www (apex domain) to www.

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

e.g. https://krystaldemo.co.uk/mypage.htm would be redirected to https://www.krystaldemo.co.uk/mypage.htm

Type: Choose a 301 (permanent) redirection. 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.

https?://: 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 non-www (apex domain)

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

e.g. https://www.krystaldemo.co.uk/mypage.htm would be redirected to http://krystaldemo.co.uk/mypage.htm

Type: Choose a 301 (permanent) redirection. 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.

https?://: 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).

Only redirect with www.: 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


How did we do?


Powered by HelpDocs
© Krystal Hosting Ltd 2003–2019