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
- In cPanel, go to Domains > Redirects.
- Under Type, choose Permanent (301).
- In the domain menu, choose your domain. (An All Public Domains option is also listed; for most accounts, just pick your domain.)
- In the / box, enter the old path you want to redirect, without the domain. For example, to redirect
example.com/old-page.html, enterold-page.html. To redirect a whole folder, enter the folder name, such asblog. Leave it empty to redirect the entire domain. - In Redirects to, enter the full new address, including
https://, for examplehttps://example.com/new-page/. - In the www options, choose Redirect with or without www. so both versions of the old address are covered.
- 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-1tohttps://newsite.com/post-1). - 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.
- 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. - Right-click
.htaccessand choose Edit. Download a copy first as a backup. - Add your rules near the top of the file, above any
# BEGIN WordPresssection, 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
- How to Force HTTPS on Your Website
- WWW or Non-WWW: How to Redirect Your Domain
- How to Show Hidden Files (.htaccess) in cPanel File Manager
- One Website Per Account: What Your Hosting Plan Includes
Still stuck? Open a support ticket and the Instant Access Internet Services team will help.
