How to Set Up a 301 Redirect in cPanel

A redirect sends visitors (and search engines) from one address to another automatically, for example when you rename a page or move to a new domain. This guide shows Instant Access Internet Services customers how to set up a 301 redirect in cPanel with the Redirects tool, and how to add one by hand in .htaccess when you need more control.

301 or 302?

  • Permanent (301): the page has moved for good. Search engines move the old page's ranking to the new address. Use this in almost every case.
  • Temporary (302): the page is away for a short time and will come back. Search engines keep the old address indexed.

How to set up a 301 redirect in cPanel

  1. In cPanel, go to Domains > Redirects.
  2. Under Type, choose Permanent (301).
  3. In the domain menu, choose your domain. (An All Public Domains option is also listed; for most accounts, just pick your domain.)
  4. In the / box, enter the old path you want to redirect, without the domain. For example, to redirect example.com/old-page.html, enter old-page.html. To redirect a whole folder, enter the folder name, such as blog. Leave it empty to redirect the entire domain.
  5. In Redirects to, enter the full new address, including https://, for example https://example.com/new-page/.
  6. In the www options, choose Redirect with or without www. so both versions of the old address are covered.
  7. Tick Wild Card Redirect only if you are redirecting a folder or whole domain and want every page inside it to go to the same path on the new site (for example /blog/post-1 to https://newsite.com/post-1).
  8. Click Add.

Your redirect appears in the Current Redirects table. Click the link in the Directory column to test it.

Changing or removing a redirect

Redirects can't be edited. To change one, click Delete next to it in Current Redirects, confirm, and add it again with the new settings.

Redirecting a whole site to a new domain

If you've moved to a new domain and the old domain still points to this account, leave the / box empty, enter your new domain in Redirects to (for example https://newdomain.com/), and tick Wild Card Redirect so each old page goes to the matching page on the new domain.

Your plan includes one website per account, so the old and new domains can't both be hosted here at once. See One Website Per Account: What Your Hosting Plan Includes if you're not sure how to handle a domain change.

Adding a 301 redirect in .htaccess

The Redirects tool writes rules into the .htaccess file in public_html. You can also add rules there yourself, which is handy for many redirects at once.

  1. In cPanel, go to Files > File Manager and open public_html. If you can't see .htaccess, click Settings and tick Show Hidden Files (dotfiles). See How to Show Hidden Files (.htaccess) in cPanel File Manager.
  2. Right-click .htaccess and choose Edit. Download a copy first as a backup.
  3. Add your rules near the top of the file, above any # BEGIN WordPress section, and click Save Changes.

Examples:

Redirect 301 /old-page.html https://example.com/new-page/
Redirect 301 /old-folder/ https://example.com/new-folder/

Troubleshooting

My redirect doesn't work on a WordPress site

WordPress's own rules can catch the request before a redirect at the bottom of .htaccess is read. Move the redirect lines above # BEGIN WordPress, or use a redirect plugin inside WordPress instead.

I changed a redirect but the browser still goes to the old place

Browsers remember 301 redirects. Test in a private/incognito window, or clear your browser cache.

"Too many redirects" error

A redirect is pointing back at itself, directly or through another rule. The most common cause is redirecting a domain to another version of the same domain (such as www or https). For those, use How to Force HTTPS on Your Website or WWW or Non-WWW: How to Redirect Your Domain instead of the Redirects tool, and delete the looping redirect.

Should I use a redirect for http to https?

No. Use the Force HTTPS Redirect switch in Domains. See How to Force HTTPS on Your Website.

Related guides

Still stuck? Open a support ticket and the Instant Access Internet Services team will help.

Ultrafast LiteSpeed hosting from InstantAccess.net: free SSL, free backups, cPanel included, no contracts. Check out our $10/month hosting.
  • 301 redirect cpanel, cpanel redirects, redirect a page to another url, permanent redirect htaccess, redirect old url to new url, 302 vs 301 redirect
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Use Microsoft 365 or Google Workspace Email with Your Domain

You can keep your website with us and use Microsoft 365 (Outlook) or Google Workspace (Gmail) for...

Our Nameservers: How to Point Your Domain to Your Hosting

To make your website and email work on your hosting account, your domain has to point to the...

DNS Propagation: Why Domain Changes Take Time and How to Check

When you change your nameservers or edit a DNS record, some people see the change right away...

How to Set Up Dynamic DNS in cPanel

Dynamic DNS (DDNS) lets you reach a device on a home or office connection, such as a camera, NAS...

Free SSL Certificates: How AutoSSL and SSL/TLS Status Work

Every hosting account includes free SSL certificates, so your website loads over HTTPS with a...