UnderHost
Knowledgebase Docs

Redirects in cPanel: create, test, and remove

Create 301 and 302 redirects in cPanel, choose wildcard and www options, force HTTPS safely, test redirect behavior, and remove old rules without breaking .

On this page

Redirects send visitors and search engines from one URL to another. Use them when you rename a page, move a section of your site, retire an old domain, or need a temporary destination while maintenance is underway.

When to use redirects

  • Move an old page such as /old-page.html to a new URL.
  • Redirect an old domain to a new domain after a rebrand or .
  • Temporarily send visitors to a maintenance page.
  • Preserve search engine value after changing your URL structure.

cPanel creates redirect rules in the site's .htaccess file. If you already have custom rewrite rules, back up .htaccess before adding or removing redirects.

301 vs 302 redirects

TypeHTTP codeWhen to use
Permanent301The old URL has permanently moved. Use this for page moves, domain changes, and most site s.
Temporary302The change is short-term. Use this for maintenance pages, temporary campaigns, or testing.

Create a redirect in cPanel

  1. Log in to cPanel.
  2. Open Domains and choose Redirects.
  3. Select Permanent (301) or Temporary (302).
  4. Select the source domain.
  5. Leave the path blank to redirect the whole domain, or enter a specific path such as old-page.html.
  6. Enter the full destination URL, including https://.
  7. Choose the www and wildcard options that match your goal.
  8. Click Add.

cPanel writes the redirect as a rule in your .htaccess file automatically. The redirect is active immediately.

www and wildcard options

OptionWhat it doesTypical use
Only redirect with wwwRedirects www.example.com but not example.com.Rare; use only when you deliberately split www and non-www behavior.
Redirect with or without wwwCovers both example.com and www.example.com.Best for most whole-domain redirects.
Wildcard redirectPreserves the requested path when sending traffic to another domain.Redirect /old/path to https://newdomain.com/old/path.
Avoid redirect chains

Do not redirect a URL to another URL that redirects again if you can avoid it. Send visitors directly to the final destination to improve speed and reduce browser or cache confusion.

Force HTTPS

If AutoSSL is active for the domain, use cPanel's Domains interface and enable Force HTTPS Redirect when the toggle is available. This is usually cleaner than creating a manual HTTP to HTTPS redirect in the Redirects tool.

If your cPanel theme does not show that option, add a standard HTTPS rule to the top of the domain's .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Remove and test redirects

To remove a cPanel-created redirect, go back to Domains, open Redirects, find the redirect in the list, and click Delete. If the rule was edited manually in .htaccess, remove it from the file instead.

Test in a private browser window or with a redirect checker after clearing your browser cache. Browsers cache 301 redirects aggressively, so a redirect can appear to remain even after it has been removed.

Troubleshooting redirects

ProblemWhat to check
Redirect loopLook for conflicting WordPress, Cloudflare, SSL, or .htaccess rules.
Redirect does not workConfirm the domain points to this cPanel account and that Apache is reading the correct document root.
Wrong page redirectsCheck wildcard settings and whether a broader rule appears above a specific rule.
HTTPS redirect failsMake sure AutoSSL has issued a valid certificate before forcing HTTPS.

For more complex patterns, use .htaccess directly:

# Single URL redirect
Redirect 301 /old-page.html https://yourdomain.com/new-page/

# Wildcard redirect: all paths under /blog/ to /articles/
RedirectMatch 301 ^/blog/(.*) https://yourdomain.com/articles/$1

Related: Advanced .htaccess in cPanel: redirects, PHP settings, and access rules | How to create and manage addon domains in cPanel | SSL/TLS management in cPanel-install, check, and renew | Index files in cPanel: default homepage names and troubleshooting | How to point a domain to UnderHost hosting

Was this article helpful?

Need cPanel hosting or licensing?

Use UnderHost cPanel hosting or add cPanel/WHM to a VPS or dedicated server for familiar website, email, DNS, and database management.

Related articles

Back to cPanel