Quick answer: Use a 301 when a page has moved for good. Use a 302 when the move is temporary and the old address will come back. Google treats a permanent redirect as a strong sign that the new URL should show in search. A temporary redirect usually keeps the old URL in search.
The four redirect codes
- 301 Moved Permanently: the normal choice for moved pages, HTTP to HTTPS, and domain changes.
- 308 Permanent Redirect: like 301, but forms keep their data. Google treats it like a 301.
- 302 Found: temporary. Use it for short sales pages, maintenance, or tests.
- 307 Temporary Redirect: like 302, but forms keep their data.
When to use which
- Moved or renamed a page: 301
- Moved to HTTPS or to a new domain: 301
- Joined two pages into one: 301 to the page that stays
- Product out of stock for a week: 302, or better, keep the page live
- Seasonal page that comes back next year: 302
Copy-paste rules for .htaccess
These work on Apache and LiteSpeed. Put them above the # BEGIN WordPress block. Make a backup first: one typo can cause an error 500.
One page
Redirect 301 /old-page/ https://example.com/new-page/
Force HTTPS and remove www
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]
</IfModule>
This sends every old address to the final HTTPS address in one hop, instead of two.
Mistakes to avoid
- Redirect chains. A → B → C is slow and wastes crawling. Point A straight to C.
- Sending everything to the homepage. Google may treat this as a “soft 404”. Redirect to the closest matching page, or let the page return 404 or 410.
- Using 302 for a permanent move. The old URL may stay in Google for months.
- Redirect loops. Two rules that point at each other. Browsers show “too many redirects”.
- Removing redirects too soon. Keep them for at least a year. Old links and bookmarks still use them.
Check it with our free tools: Redirect Checker · .htaccess Redirect Generator