Domains

Set up 301 and 302 redirects in cPanel

Create permanent 301 and temporary 302 redirects in cPanel Redirects: whole domains, single pages, www handling and wildcard redirects, plus how to remove them.

BeginnercPanel hosting3 min read

Redirects send visitors and search engines from one address to another. Use them when you move a page, change domain, or want an old URL to keep working. cPanel's Redirects tool writes the rules into your .htaccess file for you, so you do not have to edit code.

Before you start

  • Know the exact old address and the new destination, including https://.
  • Choose the type:
    • Permanent (301): the move is final. Search engines pass ranking to the new URL. Use this in almost every case.
    • Temporary (302): for short-term moves, maintenance pages or A/B tests.

Create a redirect

  1. Open cPanel → Domains → Redirects.
  2. Pick Type: Permanent (301) or Temporary (302).
  3. In https?://(www.)? choose the domain, or ** All Public Domains **.
  4. In the path box after the slash, enter the old path, for example old-page.html or blog/2023-offer. Leave it empty to redirect the whole domain.
  5. In Redirects to, enter the full new address, e.g. https://example.com/new-page/.
  6. Under www. redirection choose Redirect with or without www. (most common), Only redirect with www. or Do Not Redirect www.
  7. Tick Wild Card Redirect if every file under the path should go to the same file name at the destination, e.g. /docs/a.html → https://new.com/docs/a.html.
  8. Click Add.

Common examples

GoalDomain / pathRedirects toWildcard
Move a whole domainolddomain.com /https://newdomain.com/Yes
Rename one pageexample.com / about-us.htmlhttps://example.com/about/No
Send a subdomain to the main siteshop.example.com /https://example.com/shop/No

Check the redirect

  • Open the old URL in a private browser window; it should land on the new address.
  • Browsers cache 301s strongly. If you change a 301, test in a new private window or with curl -I https://example.com/old-page.html and look for 301 and Location:.

Force HTTPS is different

To send all http:// traffic to https://, do not add a redirect here; use the Force HTTPS Redirect switch in cPanel → Domains → Domains. See force HTTPS in cPanel.

Remove or edit a redirect

Scroll to Current Redirects at the bottom of the page and click Delete next to the rule. There is no edit button: delete it and add it again with the new values.

Note: Redirects are stored in the .htaccess file of the domain's document root. Plugins such as WordPress caching or security tools also edit that file, so keep a copy before big changes.

Troubleshooting

ERR_TOO_MANY_REDIRECTS

The destination redirects back to the source, often because WordPress, Cloudflare or a plugin adds its own redirect. Remove one side of the loop. See fix redirect loops.

Redirect does nothing

An earlier rule in .htaccess (for example WordPress rewrites) catches the request first. Open the file in File Manager and move the cPanel rules above the # BEGIN WordPress block.

500 error after adding a redirect

The .htaccess has a syntax error. Remove the last added lines. See fix 500 errors on cPanel.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.