A redirect sends a visitor from one address to another. Choosing the wrong type quietly costs you search rankings.
301 or 302?
- 301, permanent. Use this for anything that has genuinely moved for good. Search engines transfer the ranking to the new address and update their index. This is what you want almost every time.
- 302, temporary. The original address keeps its ranking because you are saying it will be back. Use it for a page temporarily diverted – maintenance, a seasonal offer.
The common mistake is using 302 for a permanent move. The new address never inherits the ranking, and the old one gradually loses it because it no longer serves anything.
Doing it in cPanel
For a whole domain or a single page, use the Redirects tool. It writes the rule for you and is far safer than editing .htaccess by hand.
Doing it in .htaccess
A single page:
Redirect 301 /old-page.html https://www.example.com/new-page.html
A whole domain to another:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old-domain\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.old-domain\.com [NC]
RewriteRule ^(.*)$ https://www.new-domain.com/$1 [R=301,L]
Two things to watch
- Redirect loops. If a rule sends A to B and something else sends B back to A, the browser gives up. Test in a private window, because browsers cache 301s aggressively – a cached bad redirect can persist long after you fix it.
- Order matters. Rules are read top to bottom and the first match with [L] wins. Put specific rules above general ones.