How to redirect a domain in cPanel
cPanel’s Redirects screen sends the visitors of a domain or a single page to another address. This guide shows how to redirect a whole domain or one page, when to choose 301 or 302, how the www options work, how to force HTTPS, and how to fix redirects that loop or do nothing.
Short answer
To redirect a domain in cPanel, open Domains » Redirects. Choose Permanent (301) or Temporary (302) in Type, pick the domain, leave the / box empty for the whole site, enter the target address with https:// in Redirects to, choose a www. option and click Add. For HTTP to HTTPS, use the Force HTTPS Redirect toggle on Domains » Domains instead.
- Where
- cPanel » Domains » Redirects
- You need
- A cPanel login and the domain to redirect on your account
- Applies to
- cPanel & WHM 134 (LTS) to 138, Jupiter theme
- Rules saved in
- The .htaccess file in the domain’s document root
301 or 302
The Type menu on cPanel’s Redirects screen offers two kinds of redirect. Both send the visitor on at once; they differ in what search engines and browsers remember.
| Type | Use it when | Effect |
|---|---|---|
| Permanent (301) | The page or domain has moved for good, for example to a new domain | Search engines update their records to the new address; browsers cache the redirect |
| Temporary (302) | The move is short, for example during maintenance | Search engines keep the old address in their records |
NoteBrowsers keep 301 redirects in their cache. Test a new 301 in a private window, and use 302 while you are still unsure of the target.
Redirect a whole domain
- Log in to cPanel and, in the Domains section, click Redirects.
- In Type, choose Permanent (301) or Temporary (302).
- In the domain menu, pick the domain to redirect, for example
old-example.com. All Public Domains redirects every domain on the account. - Leave the / box empty, so the rule applies to the whole domain.
- In Redirects to, enter the target with its protocol, for example
https://example.com/. cPanel requires the protocol. - Choose Redirect with or without www., so both
old-example.comandwww.old-example.commove. - Tick Wild Card Redirect to send each page to the same path on the target, for example
old-example.com/abouttohttps://example.com/about. Without it, cPanel only redirects the exact address you entered. - Click Add, then Go Back on the confirmation page.
- Test the rule with the link in the Directory column of the Current Redirects table.
NoteThe Redirects screen only lists domains on your cPanel account, and the www. options are disabled when All Public Domains is selected. To redirect a domain that has no site of its own, first add it on Domains » Domains as an alias and point its DNS to the server.
Redirect a single page or folder
To move one address, such as a renamed page, enter its path in the / box on the Redirects screen. The path is everything after the domain, without the first slash, for example old-page.html for example.com/old-page.html.
- In Type, choose Permanent (301).
- Pick the domain in the menu.
- In the / box, enter the old path, for example
old-page.htmlorblog/old-post. - In Redirects to, enter the full new address, for example
https://example.com/new-page/. - Choose Redirect with or without www., leave Wild Card Redirect unticked and click Add.
A folder works the same way on the Redirects screen. Enter the folder, such as old-folder, in the / box and tick Wild Card Redirect to send every file inside it to the same file name under the new address.
Redirect www or non-www
Each redirect on cPanel’s Redirects screen has one of three www. options. They decide which form of the domain the rule matches, not where visitors end up.
| Option | Which visitors are redirected |
|---|---|
| Only redirect with www. | Only visitors who type www.example.com |
| Redirect with or without www. | Everyone, with or without www |
| Do Not Redirect www. | Only visitors who type example.com without www |
To send www.example.com to example.com, add a Permanent (301) redirect for example.com with Only redirect with www., the target https://example.com/ and Wild Card Redirect ticked. For the opposite direction, choose Do Not Redirect www. and the target https://www.example.com/.
NoteNever redirect a domain to itself with Redirect with or without www.. The rule then also matches its own target, and the browser stops with “ERR_TOO_MANY_REDIRECTS”.
Force HTTPS
To move visitors from http:// to https://, use the Force HTTPS Redirect toggle on Domains » Domains, not the Redirects screen. cPanel’s own Redirects documentation points to this toggle for HTTPS.
- Open Domains » Domains.
- Find the domain and set Force HTTPS Redirect to On.
- To change several domains at once, tick their boxes and click Force HTTPS Redirect On at the top of the table.
The Force HTTPS Redirect toggle only works when the domain has a valid SSL certificate, for example one from AutoSSL. Aliases have no toggle of their own; they follow the domain they belong to.
cPanel builds the Force HTTPS redirect into the web server configuration for the domain, not into .htaccess, so the site does not need a separate HTTPS rule in .htaccess.
Where cPanel saves redirects
cPanel’s Redirects screen writes each rule at the bottom of the .htaccess file in the domain’s document root; for the main domain that is public_html/.htaccess. A redirect can therefore stop working when another application also uses that file.
WordPress, and many caching or security plugins, add their own rules to .htaccess. Because cPanel’s redirect rules come last, WordPress may handle the request before the redirect runs. Moving the redirect lines above the # BEGIN WordPress line fixes this.
- Open Files » File Manager.
- Click Settings, select Show Hidden Files (dotfiles) and click Save.
- Open the document root, for example
public_html, select.htaccessand click Edit. - Copy the current contents somewhere safe, make the change and save the file.
A manual 301 redirect in .htaccess can be a single line, for example Redirect 301 /old-page.html https://example.com/new-page/. Put it near the top of the file, above any application’s block.
NoteOne wrong line in .htaccess can take the whole site down with “500 Internal Server Error”. If that happens, put back the copy you saved.
Change or delete a redirect
cPanel’s Redirects screen cannot edit an existing redirect. To change one, delete it in the Current Redirects table and add it again with the new values.
- Open Domains » Redirects and find the rule in Current Redirects. The Search box filters the table.
- Click Delete, then Yes to confirm.
- Add the redirect again with the new values.
Browsers cache redirects, 301s especially. After you change or delete a redirect, test it in a private window; visitors who already followed an old 301 may keep going to the old target until their browser cache clears.
Common problems
- The browser shows “ERR_TOO_MANY_REDIRECTS” or “The page isn’t redirecting properly”.
- Two rules send visitors back and forth, for example Force HTTPS Redirect while WordPress’s Site Address (URL) still starts with
http://, or a domain redirected to itself. A proxy such as Cloudflare set to reach the server over plain HTTP (Flexible SSL) causes the same loop. Remove one of the rules, then clear the browser cache. - The redirect does nothing on a WordPress site.
- cPanel added the rule at the end of
.htaccess, after WordPress’s own rules, which handle the request first. Open.htaccessin File Manager and move the redirect lines above# BEGIN WordPress, or set the redirect in WordPress instead. - The old redirect still happens after I deleted it.
- The browser cached it. Test in a private window or clear the cache; visitors who followed a 301 may be sent to the old target until their own cache expires.
- The Force HTTPS Redirect toggle cannot be switched on, or is missing.
- The toggle needs a valid SSL certificate on the domain, and it does not appear for aliases, which follow their parent domain. Check SSL/TLS Status, wait for AutoSSL or install a certificate, then try again.
- Visitors land on “404 Not Found” after the redirect.
- With Wild Card Redirect ticked, every old path is sent to the same path on the target, which must exist there. Redirect missing pages one by one, or untick the option so visitors land on the target address itself.
- The domain I want to redirect is not in the menu.
- The Redirects screen only lists domains on your cPanel account. Add the domain on Domains » Domains first, as an alias if it needs no site of its own, and point its DNS to the server.
Doing it from CTAServer
Redirects on cPanel servers are not set from CTAServer; they stay on cPanel’s Redirects screen and the Force HTTPS Redirect toggle on cPanel’s Domains screen. CTAServer helps when a redirect needs a manual fix in .htaccess.
- CTAServer’s file manager works as the account’s user through cPanel’s file functions and can open and edit a site’s
.htaccessfile, for text files up to 2 MB. That is enough to move cPanel’s redirect lines above a WordPress block or to delete a rule that loops. - A domain’s DNS records can be edited on CTAServer’s DNS zones screen through WHM’s API, for example to point an old domain to the server before you redirect it. Each change also appears in cPanel’s Zone Editor.
- Adding the domain you want to redirect, as an addon domain or an alias, is not done from CTAServer; that stays in cPanel.
cPanel management with CTAServer The hosting accounts screen The DNS zone editor screen
Frequently asked questions
Should I use a 301 or a 302 redirect?
Use 301 (Permanent) when the move is final, such as a new domain or a renamed page; search engines then update their records to the new address. Use 302 (Temporary) for short moves such as maintenance, when the old address should stay in search results.
How do I redirect an old domain to a new one without losing search traffic?
Keep the old domain on the account, then in Domains » Redirects add a Permanent (301) redirect to the new domain with Redirect with or without www. and Wild Card Redirect, so every old page lands on the same path. Keep the old domain registered and the redirect in place for at least a year.
How do I redirect HTTP to HTTPS in cPanel?
Open Domains » Domains and set Force HTTPS Redirect to On for the domain. The toggle only works once the domain has a valid SSL certificate, and aliases follow their parent domain. cPanel’s Redirects screen is not meant for this.
How do I redirect www to non-www in cPanel?
In Domains » Redirects, choose Permanent (301), pick the domain, choose Only redirect with www., enter https://example.com/ in Redirects to, tick Wild Card Redirect and click Add. For non-www to www, choose Do Not Redirect www. and enter the www address as the target.
Can I edit a redirect in cPanel?
No. cPanel’s Redirects screen cannot change an existing redirect. Delete it in the Current Redirects table and add it again with the new values, or edit the rule directly in the domain’s .htaccess file.
Where does cPanel store redirects?
In the .htaccess file in the domain’s document root, which for the main domain is public_html/.htaccess. cPanel adds its rules at the bottom of the file. File Manager shows the file once Show Hidden Files (dotfiles) is selected in its Settings.
Connect your first server today.
Free for 7 days, no card needed. Create your account, add your first server with an API token or an SSH key, and the panel starts filling in a few minutes later.
No setup fee · Cancel anytime · EU-hosted