When you set up a redirect in cPanel, a user arriving at the server for the requested URL will be told to go elsewhere. Depending on the type of redirect, you can also control whether that redirect is seen as permanent or temporary.
This article will review the types of redirects available when on your server and the steps for setting up a redirect in your cPanel account Redirect utility. If you need more information about what a URL redirect is, and the differences between the two, please see our companion article What are URL Redirects?
Available Redirect Types
There are five types of redirects: 301, 302, 303, 307, and 308. Of these 5 types only the two most commonly used redirects are available for use in the cPanel redirect utility
- 301 - Permanent Redirect
- 302 - Temporary Redirect
If you need assistance creating a 303, 307 or 308 redirects, these will need to be done using a .htaccess file. Please feel free to reach out to our support department for assistance with those types of redirects.
Setting up the Redirects in cPanel
To add a redirect, perform the following actions:
- Log into the cPanel account for the domain you would like to redirect and select Redirects icon under the Domains section of the cPanel account page.
- From inside of the Redirect utility select a redirect type from the Type dropdown menu.
Permanent (301) — This option notifies the visitor’s browser to update its records.
Temporary (302) — This option does not update the visitor’s browser.
- Select a domain name from the menu, or select **All Public Domains** to redirect all of the domains that your cPanel account controls.
- The next unnamed text box is a little tricky. This text box allows you to redirect individual file paths associated with the domain or site. Enter the rest of the URL file path you wish for the server to redirect.
For example, if you wish to redirect http://example.com/blog l to another URL, enter blog in this text box.
There is no need for the first “slash” in the file path as the box has one by default. If there is an additional slash in the file path it will need to be entered in the text box.
For example, if you wish to redirect http://example.com/blog/new you would enter blog/new in this text box.
(See step 7 “Wild Card Redirect” setting below to redirect all file path requests.)
- In the Redirects to text box, enter the URL which you wish to redirect users to.
You must specify a protocol in this text box. For example, http://, https://, or ftp://.
- Select one of the following options:
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 the 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 the domain name part of the URL.
The interface disables the www. redirection option if you select **All Public Domains**.
- Select the Wild Card Redirect option if you wish to redirect all files within a directory to the same filename in the new directory.
For example, if you enable the Wild Card Redirect option and example1.com redirects to example.com, then a visitor who tries to access the http://example1.com/pic.jpg URL redirects to the http://example.com/pic.jpg URL.
- 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.
- If you use a third-party application or content management system to add a redirect, such as WordPress, the redirect may not function properly. When you add a redirect with cPanel interface, the system places redirect rules at the bottom of the .htaccess file. Some third-party applications ignore the rule that you add, because those applications only read rules and configurations that their section of the .htaccess file contains.
- You cannot edit a redirect. To modify a redirect, you must delete it, and then recreate it.