Home > Help Center > Shared Hosting > Control Panel > URL Redirects in cPanel

URL Redirects in cPanel

The Redirects interface allows you to send all of the visitors of a domain or particular page to a different URL.

For example, if create a page with a long URL, use the Redirects interface to add a redirect from a short URL to the long URL. Visitors can enter the short URL to access the content of the long URL.

Warning: if ModSecurity is enabled on the server this feature will not work.

To enter Redirects interface go to cPanel > Domain and click Redirects link:

cpanel url redirects

Add a redirect

Select a redirect type from the Type menu:

cpanel url redirects

Permanent (301) - this option notifies the visitor's browser to update its records.

Temporary (302) - this option does not update the visitor's bookmarks.

Select a domain name from the menu, or select All Public Domains to redirect all of the domains that your cPanel account controls:

cpanel url redirects

In the text box to the right of the domain selection menu, enter the rest of the URL from which you wish for the server to redirect visitors. For example, if you wish to redirect http://hostpulse-addon/hostpulse/index.html to another URL, enter hostpulse in this text box.

In the redirects to text box, enter the URL to which you wish to redirect users:

cpanel url redirects

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.

Select the Wildcard 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:

cpanel url redirects

Click Add.

A confirmation message will appear:

cpanel url redirects

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:

cpanel url redirects

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.

The following example displays the configuration that you must add to the top of the .htaccess file to add a redirect for the Drupal content management system.

In the following example:

drupal.user.example.com represents the URL to redirect.

http://cpanel.net/ represents the URL to which to redirect.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{HTTP_HOST} ^drupal\.user\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.drupal\.user\.example\.com$
RewriteRule ^cptest$ "http\:\/\/cpanel\.net\/" [R=301,L]
</IfModule>

Note: You cannot edit a redirect. To modify a redirect, you must delete it, and then recreate it.

Remove a redirect

Click Delete next to the redirect that you wish to remove.

cpanel url redirects

Click Remove Redirect.

Conclusion

We hope the information in this tutorial will help you to manage easily the URL redirects in your cPanel hosting.

Reference: documentation.cpanel.com

#tools

Still not finding what you're looking for?

Contact our support team with any additional questions or concerns.

Contact support