To add a redirect:
- Click on Redirects under Domains in cPanel.
- Under Add Redirect, select the desired redirection type: Permanent or Temporary.
- Select the domain from the https://www. drop-down menu.
If you want to redirect all domains that your cPanel controls, select ** All Public Domains **
- Enter the rest of the URL from which you want to redirect visitors from. For example, if you want to redirect
http://yourdomain.com/sample_folder/sample_file.html
then you will entersample_folder/sample_file.html
in the text box
- In the Redirects to text box, enter the URL to which you wish to redirect users. You can redirect the web page to another web page on your website or one that is on a completely different website. NOTE: You must specify a protocol in this text box, ie. http:// or https://
-
Select the desired www.redirection option.
- Only redirect with www. – this option only redirects visitors who enter the
www.
prefix before the domain name part of the URL. - Redirect with or without www. – this option redirects all users, regardless of whether the visitor enters
www.
prefix before the domain name part of the URL. - Do not redirect www. – this option does not redirect users who enter the
www.
prefix before the domain name part of the URL.
- Only redirect with www. – this option only redirects visitors who enter the
-
Select the Wildcard Redirect option if you want to redirect all fines within a directory to the same filename in the new directory.
For example, if you enabled this option and specified that sampledomain.net redirects to anotherdomian.com, then a visitors who tries to access http://sampledomain.net/image1.jpg
will be redirected to http://anotherdomain.com/image1.jpg
- When ready, click Add.
To test the redirect, click the link under Directory in the Current Redirects table. If you properly configured the redirect, the system directs you to the original domain.
Difference between a permanent and a temporary redirect:
To a website visitor, a permanent and a temporary redirect work the same way. But they aren't the same as far as search engines are concerned.
Search engines handles them differently. A permanent, or 301, redirect means that the page has permanently moved to a new location. A temporary, or 302, redirect means the move is only temporary. Search engines need to figure out whether to keep the old page or replace it with the one found at the new location.
Why does this matter to you?
Say you have moved your website to a new domain. If you used a 302 (temporary) redirect, your website visitors will be redirected, but search engines see it as a temporary redirect and will continue to index your old, outdated URLs. However, when you use a 301 redirect, it will request search engines to update the URL in their database, thus changing the URL of your page when it shows in search engine results.
When to use a 302 temporary redirect:
- A/B testing of a web page
- Updating a web page while providing viewers with a consistent experience
When to use a 301 permanent redirect:
- You have moved your website to a new domain
- http to https migration
For more details on 301 permanent redirects, see Google's help page