A properly configured 301 redirect passes almost all of the old URL's authority to the new one, so rankings dip only briefly after a move, typically for two to four weeks, and then recover. Sites lose traffic not because of the redirect itself but because of the mistakes around it: everything pointed at the homepage, chains of three hops, old links still sitting in the menu, and a sitemap full of retired URLs. Below we cover how 301 differs from 302 and 308, when you actually need it, how to write the rules in .htaccess and nginx, and how to confirm it all worked.

The server response code tells the browser and the search engine that a page has moved and how to treat that move. For SEO, the distinction between permanent and temporary is what matters: with a permanent move Google gradually replaces the old URL in its index with the new one, with a temporary move it keeps the old URL and waits for it to come back.
| Code | Meaning | Request method | When to use |
|---|---|---|---|
| 301 | Permanent move | May change to GET | URL or domain change, merging pages, switching to https |
| 302 | Temporary redirect | May change to GET | Promotions, A/B tests, page temporarily unavailable |
| 307 | Temporary, method preserved | Unchanged | Forms and APIs where POST must stay POST |
| 308 | Permanent, method preserved | Unchanged | Same as 301, but for POST requests |
| meta refresh | Redirect at the HTML page level | Not applicable | Only when there is no server access; Google processes it more slowly |
For most sites the choice boils down to two options: 301 for good, 302 for a few days. The "302 or 301" dilemma is settled by one question: will the old URL ever come back? If not, use 301. Google has long confirmed that both codes pass PageRank, but with a 302 the search engine keeps the old page in the index longer and may never switch to the new one at all. At Query we have seen plenty of sites where a 302 stayed in place for a year after a redesign, while the search results kept showing old URLs that returned a 404 on click.
Google also understands meta refresh and JavaScript redirects, but processes them more slowly and not always reliably. Treat them as a fallback for website builders with no access to server configuration, not as the main tool.
The line itself takes a minute to write. Rankings are lost in the preparation, so the order of steps matters.

On Apache, redirects live in the .htaccess file in the site root; on nginx, in the server configuration (nginx.conf or the site file in sites-available). After editing nginx you need to reload it with nginx -s reload; Apache picks up .htaccess changes immediately.
One page to a new address:
Redirect 301 /old-page/ https://site.com/new-page/
The whole site from http to https and to the non-www version in a single rule:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://site.com/$1 [R=301,L]
Moving to a new domain while keeping the paths:
RewriteCond %{HTTP_HOST} ^(www\.)?old-site\.com$ [NC]
RewriteRule ^(.*)$ https://new-site.com/$1 [R=301,L]
A single page:
location = /old-page/ { return 301 https://site.com/new-page/; }
The whole domain, http and www together:
server {
listen 80;
server_name old-site.com www.old-site.com;
return 301 https://new-site.com$request_uri;
}
In nginx, rules written with return 301 run faster than rewrite, and they are the right choice for large-scale moves. WordPress and other CMSs have redirect plugins, but for hundreds of URLs a server-level rule is more reliable and does not load PHP on every request.
The fastest way: run curl -I https://old-site.com/old-page/ in a terminal. The response should contain the line HTTP/2 301 and a location: header with the final address. If the first 301 is followed by another 301 or 302, that is a chain, and it needs to be shortened to a single hop. The curl -IL command shows the whole chain at once.
For bulk checks, run the old URL list through Screaming Frog in List mode: it shows the response code, the final address and the number of hops for every row. There are plenty of free online redirect checkers too, and for a dozen URLs they are perfectly adequate.
In Search Console, watch two reports. Pages (indexing) shows whether old URLs got stuck in the "Page with redirect" bucket without the new page being indexed. Performance should show, two or three weeks in, that clicks on the new URLs have recovered to the level of the old ones. The URL Inspection tool lets you see separately how Googlebot views a specific address and which page it considers canonical.

Google recommends keeping 301 redirects for at least a year: roughly the time it takes the search engine to recrawl all the old URLs, transfer the signals and stop coming back to them. In practice we advise not removing them at all while the old domain is alive or while the old URLs still receive visits. Nobody will rewrite external links from other sites, and a year later each of them will still hit the old address.
The exception is technical rules that create load or conflict with the new structure. Review those after a year using server logs: if nobody has requested an address in 12 months, the rule can go without consequences.
robots.txt, and the authority goes nowhere.If the site has hundreds of URLs and no developer who knows the server configuration, it is safer to hand the move over as part of technical website improvements: the redirect map, server rules and post-launch checks come as one package there.
curl -I for chains.