Redirects
Redirects automatically forward visitors from one URL to another. Use them when you move pages, change domain names, or restructure your website.
Types of Redirects
cPanel supports two types of HTTP redirects:
- 301 (Permanent) — Tells browsers and search engines that the page has permanently moved to a new location. Search engines transfer the old page's ranking to the new URL. Use this for permanent changes.
- 302 (Temporary) — Tells browsers and search engines that the move is temporary. The original URL retains its search engine ranking. Use this for short-term changes like maintenance.
Tip
When in doubt, use a 301 redirect. Most redirects are permanent, and a 301 ensures search engines update their index to reflect the new URL.
Creating a Redirect
- Log into cPanel.
- In the Domains section, click Redirects.
- Select the redirect type: Permanent (301) or Temporary (302).
- Choose the domain from the dropdown. To redirect a specific page, enter the path in the field next to the domain (e.g.,
/old-page). - Enter the full destination URL, including
https://(e.g.,https://yourdomain.com/new-page). - Choose your redirect settings:
- Only redirect with www. — Only redirects the
www.yourdomain.comversion. - Redirect with or without www. — Redirects both
yourdomain.comandwww.yourdomain.com. - Do Not Redirect www. — Only redirects the non-www version.
- Only redirect with www. — Only redirects the
- Optionally check Wild Card Redirect to redirect all pages under the specified path to the same path on the new domain.
- Click Add.
Common Redirect Examples
Redirect an Entire Domain
To redirect all traffic from olddomain.com to newdomain.com:
- Type: Permanent (301)
- Domain: olddomain.com
- Path: Leave empty
- Redirects to:
https://newdomain.com - www: Redirect with or without www.
- Wild Card: Checked
Redirect a Single Page
To redirect yourdomain.com/old-page to yourdomain.com/new-page:
- Type: Permanent (301)
- Domain: yourdomain.com
- Path:
/old-page - Redirects to:
https://yourdomain.com/new-page
Redirect HTTP to HTTPS
If you have an SSL certificate installed and want to force all traffic to use HTTPS, the easiest method is to add the following to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Note
If your site uses WordPress, many security plugins can handle HTTP-to-HTTPS redirects for you. You can also enable Force HTTPS Redirect from the Domains section in cPanel.
Managing Existing Redirects
At the bottom of the Redirects page, you will see a table listing all current redirects. From here you can:
- Review the source and destination of each redirect.
- Click Delete to remove a redirect you no longer need.
Redirects via .htaccess
For more complex redirect rules, you can edit your .htaccess file directly. This gives you full control using Apache's mod_rewrite module. Some examples:
Redirect with a Query String
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=5$
RewriteRule ^page\.php$ /new-page? [R=301,L]
Redirect an Entire Directory
RewriteEngine On
RewriteRule ^old-directory/(.*)$ /new-directory/$1 [R=301,L]
Warning
Be careful when editing
.htaccess. A syntax error can make your entire website inaccessible. Always keep a backup of the original file before making changes. If your site goes down, rename or delete the .htaccess file via File Manager to restore access.