---
title: "301 redirect"
description: "301 redirect: how it differs from 302 and 308, setup on Apache, Nginx and WordPress, and the mistakes that cost traffic during a site migration."
language: "en"
locale: "en-US"
type: "definition"
canonical: "https://www.wp-masquerade.com/glossary/301-redirect/"
published: "2026-10-28T08:00:00+00:00"
modified: "2026-10-28T20:10:46+00:00"
translations:
  en-US: "https://www.wp-masquerade.com/glossary/301-redirect/index.md"
  fr-FR: "https://www.wp-masquerade.com/fr/definitions/redirection-301/index.md"
  es-ES: "https://www.wp-masquerade.com/es/glosario/redireccion-301/index.md"
  de-DE: "https://www.wp-masquerade.com/de/glossar/301-weiterleitung/index.md"
  it-IT: "https://www.wp-masquerade.com/it/glossario/redirect-301/index.md"
  pt-BR: "https://www.wp-masquerade.com/pt/glossario/redirecionamento-301/index.md"
  nl-NL: "https://www.wp-masquerade.com/nl/woordenlijst/301-redirect/index.md"
---

# 301 redirect

A 301 redirect is an HTTP response telling browsers and search engines that a URL has moved permanently to another one. Visitors land on the new URL, and Google treats the redirect as a strong signal to index the new address instead of the old one.

Changing a page's URL without telling search engines is like moving without forwarding your mail: links pointing to the old URL land on a [404 error](https://www.wp-masquerade.com/glossary/404-error/), and the page starts over from scratch. A 301 redirect prevents that loss. The server responds with a 301 (Moved Permanently) status code along with a `Location` header giving the new URL, and the browser loads it automatically.

## Permanent or temporary: the different codes

| Code | Type | Effect for Google |
| --- | --- | --- |
| 301, 308 | Permanent | Strong signal that the target should become the [canonical URL](https://www.wp-masquerade.com/glossary/canonical-url/) |
| 302, 303, 307 | Temporary | The old URL may stay in the results |
| Instant meta refresh | Treated as permanent | Only for cases where the server can't redirect |
| JavaScript redirect | Last resort | Only seen if the page renders successfully |

Google recommends a permanent redirect when you are sure it won't be reversed, and a server-side redirect whenever possible. When URLs change, it advises keeping the redirects in place as long as possible, generally at least a year, and pointing each old URL directly to its final destination.

## Setup examples

On Apache or LiteSpeed, in the [.htaccess](https://www.wp-masquerade.com/glossary/htaccess/) file, placed before the WordPress rules:

```
Redirect 301 /old-post/ https://www.example.com/new-post/
```

On Nginx, in the `server` block:

```
location = /old-post/ { return 301 https://www.example.com/new-post/; }
```

## For WordPress

When you change the slug of a published post, WordPress remembers the old one and automatically issues a 301 redirect to the new permalink. This mechanism doesn't cover everything: a change of permalink structure, a page merge or a domain migration requires explicit rules, set on the server or with a redirection plugin that also logs 404s. After a migration, test a sample of old URLs and check that they lead to the right page in a single hop.

*Video: “301 Redirects Explained In Under 4 Minutes | Help Your Site's SEO!” (WebFX)*

## Common mistakes

- **Redirect chains**: HTTP to HTTPS, then to www, then to the new URL. Each hop adds latency; Google's crawlers follow up to ten hops, but visitors pay for every round trip.
- **Sending everything to the home page**: visitors don't find what they were looking for. Redirect to the equivalent page, or leave a real 404 if there isn't one.
- **A 302 left in place** after a permanent move, often the default in some tools.
- **Redirects you didn't create**: a hacked site can redirect some visitors to spam depending on where they come from. If visitors report strange redirects, read our article on [SEO spam after a hack](https://www.wp-masquerade.com/hacked-wordpress-site-seo-spam-deindexing/).

Don't confuse this with file aliases: changing the public URL of a theme's files isn't a page move and doesn't follow the same logic, as detailed in our article on [masking WordPress and SEO](https://www.wp-masquerade.com/hide-wordpress-seo-impact/).

## Related terms

- [404 error](https://www.wp-masquerade.com/glossary/404-error/)
- [Canonical URL](https://www.wp-masquerade.com/glossary/canonical-url/)
- [Duplicate content](https://www.wp-masquerade.com/glossary/duplicate-content/)
- [htaccess file (.htaccess)](https://www.wp-masquerade.com/glossary/htaccess/)
- [nginx.conf](https://www.wp-masquerade.com/glossary/nginx-conf/)


## Sources

- [Google Search Central : redirections et recherche Google](https://developers.google.com/search/docs/crawling-indexing/301-redirects)
- [Google Search Central : déplacer un site en modifiant les URL](https://developers.google.com/search/docs/crawling-indexing/site-move-with-url-changes)
- [WordPress Developer Resources : wp_old_slug_redirect()](https://developer.wordpress.org/reference/functions/wp_old_slug_redirect/)
