301 Redirect: What It Is and How to Set One Up (2026)

February 4, 2024
7 mins read
301 Redirect: What It Is and How to Set One Up (2026)

Direct Answer

A 301 redirect is the HTTP status 301 Moved Permanently: the server tells browsers and search engines that a URL has moved for good and gives the new address in a Location header. Google then indexes the new URL and passes the old URL's ranking signals to it. You set one up in your server config (Redirect 301 in Apache .htaccess, return 301 in Nginx), with a plugin in your CMS, or at the domain level with a redirect service. Afterwards, check that the old URL answers 301 and lands on the right page in one hop.

This guide covers what a 301 does, when to use it instead of a 302 or a canonical tag, how to set one up on the most common setups, and how to check that it works and keeps your rankings.

What is a 301 redirect?#

301 is an HTTP status code. When someone requests the old URL, the server doesn't send the page. It sends a short answer that says "moved permanently" plus a Location header with the new address, and the browser requests that address straight away. Visitors only see the new page load.

httpHTTP/1.1 301 Moved Permanently
Location: https://mybrand.com/about
Diagram of a 301 redirect: the browser requests oldbrand.com/about, receives 301 with Location https://mybrand.com/about, then requests the new URL and gets 200

The word that matters is permanent. Google's documentation says a permanent redirect tells its indexing pipeline that the redirect target should be canonical[1], so the new address replaces the old one in search results over time. Browsers may also cache a 301, so returning visitors can skip the old URL entirely.

It's also the redirect people pick almost every time: about 96 in 100 redirects set up in RedirHub are 301s, and only around one account in seven has ever set up a 302 (RedirHub platform data, October 2026).

CodeMeaningUse it when
301 Moved PermanentlyPermanentA page or domain has moved for good. The right choice for most redirects.
302 FoundTemporaryThe move is short-term: a sale page, maintenance, a test. The old URL stays indexed.
307 Temporary RedirectTemporaryLike 302, but the browser must repeat the same method (for example a form POST).
308 Permanent RedirectPermanentLike 301, but keeps the request method. Useful for APIs and form endpoints.
Meta refresh / JavaScriptDependsOnly when you can't change the server. Google treats an instant meta refresh as permanent, but recommends server-side redirects.

Not sure between permanent and temporary? See 301 vs 302 redirects for the full comparison.

When should you use a 301 redirect?#

  • You changed a URL, for example a new slug, a new folder structure or a renamed product page.
  • You moved to a new domain after a rebrand or merger. Redirect each old URL to its matching new page.
  • You standardized your URLs: http:// to https://, and www to non-www (or the other way round).
  • You merged or removed pages. Send the old URL to the closest replacement, not to the homepage.
  • You own extra domains, such as typo domains or retired product names, that should point at your main site.

Use a 302 instead when you plan to switch back, and a canonical tag when duplicate versions of a page must stay reachable (more on that below).

How to set up a 301 redirect#

Where you add the redirect depends on what answers requests for the old URL today:

Your setupWhere to add the 301
Apache or shared hostingThe .htaccess file in the site's root folder
NginxThe server block for the old domain
WordPressA redirect plugin, or your host's redirect settings
Domain at GoDaddy, Cloudflare or NamecheapThe registrar's or DNS provider's forwarding settings
Old domain with no website leftA redirect service that answers for the domain via DNS

Apache (.htaccess)#

For a single page, Apache's Redirect directive is enough. The old path must start with a slash, and permanent or 301 returns a 301 status[2]. To move a whole domain and keep each path, use mod_rewrite:

apache# One page
Redirect 301 /old-page https://www.example.com/new-page

# Whole domain, keeping the path
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?oldbrand\.com$ [NC]
RewriteRule ^(.*)$ https://mybrand.com/$1 [R=301,L]

Nginx#

In Nginx, return 301 sends a permanent redirect[3] and $request_uri keeps the path and query string. Test the config with nginx -t, then reload.

nginx# One page
location = /old-page {
    return 301 https://www.example.com/new-page;
}

# Whole domain, keeping the path
server {
    listen 80;
    listen 443 ssl;
    server_name oldbrand.com www.oldbrand.com;
    # ssl_certificate lines for oldbrand.com go here
    return 301 https://mybrand.com$request_uri;
}

The https:// version of the old domain only redirects if that server still has a valid certificate for it. Without one, visitors get a certificate warning before the redirect happens.

WordPress#

A common choice is the free Redirection plugin[4], with more than 2 million active installs. Add the old path as the source, the new URL as the target, and make sure the HTTP code is 301. Step-by-step options, including plugin-free ones, are in how to redirect a URL in WordPress.

At your domain registrar#

If the old domain has no website, your registrar's forwarding may be enough. We have guides for GoDaddy domain forwarding, Cloudflare and Namecheap. Choose the permanent (301) option where you're offered one, and check whether old paths are kept or all sent to one page.

With RedirHub (no server needed)#

RedirHub answers for the old domain itself, so you don't need hosting, server access or a certificate for it. You only change the domain's root and www DNS records.

RedirHub New domain redirect screen: Redirect from oldbrand.com, Redirect to https://mybrand.com, 301 · Permanent and Keep the path selected, with the What happens panel showing each path redirecting with 301
  1. In the RedirHub dashboard, choose Domain Redirect.
  2. Enter the old domain or URL under Redirect from and the new address under Redirect to.
  3. Under Redirect type, pick 301 · Permanent.
  4. Under Paths, choose Keep the path so /about lands on the new /about, or Everything to one URL. The What happens panel shows where sample addresses will go.
  5. Click Create redirect. It's saved right away and goes live once DNS points to RedirHub.
  6. Open Hostnames, select the domain and click Connect DNS. On the Manual tab, add the records shown: an A record for @ (3.33.236.10), a TXT record to verify the domain, and a CNAME for www.
  7. Click I've made the changes. When the domain shows Connected, the 301 is live, with HTTPS for the root and www issued automatically.

How to check a 301 redirect#

Run curl with -I to see only the response headers. A correct redirect shows 301 and the new address in location:

bashcurl -sI https://oldbrand.com/about

HTTP/2 301
location: https://mybrand.com/about
  • Status code is 301 (or 308), not 302, if the move is permanent.
  • Location is the final URL, so there's one hop instead of a chain.
  • The destination answers 200, not 404 or another redirect.
  • Every variant works: http:// and https://, with and without www, and a deeper page as well as the homepage.

Prefer a browser? The redirect checker lists every hop with its status code, and the redirect speed test also shows whether HTTPS is valid and how fast the redirect answers. Use a private window when you test by hand, because browsers cache 301s.

Is your redirect working? Enter your domain. You'll see the status code (301 or 302), where it lands, whether HTTPS is valid, and how fast it answers from Washington, Frankfurt and Tokyo, ranked against every redirect tested in the last 7 days.

Test my redirect

Yes. Google's Gary Illyes said in 2016 that 30x redirects don't lose PageRank anymore[5], and Google's documentation treats a permanent redirect as a signal that the new URL is the canonical one. Backlinks to the old URL keep counting for the new one.

Three things still cost rankings. Chains: Google advises redirecting to the final destination directly[6]. Irrelevant destinations: sending old pages to the homepage or an unrelated page can be treated as a soft 404. Removing redirects too early: Google recommends keeping them for as long as possible, generally at least a year[6].

301 Redirect or Canonical Tag?#

Both deal with duplicate URLs, but they work differently. A 301 sends visitors and crawlers to the new URL, and the old one stops being reachable. A canonical tag (rel="canonical") keeps every version live and only tells search engines which one to index.

  • Use a 301 when a page has moved for good. That covers a new URL structure, a domain change or rebrand, merged or retired pages, and expired content such as a finished event.
  • Use a canonical tag when several versions must stay available to visitors, such as print versions, URLs with sorting or filter parameters, or regional pages with near-identical content.
  • Don’t combine the two on the same URL. Once the old URL redirects, crawlers never see its canonical tag anyway.

Common 301 redirect mistakes#

  • Chains and loops. A → B → C wastes a hop on every visit; A → B → A never loads. Point every old URL straight at the final page.
  • Everything to the homepage. It's quick, but visitors lose context and search engines may treat it as a soft 404.
  • A 302 where you meant a 301. Some tools default to temporary. If the move is permanent, check the status code.
  • Only the root redirects. Deep links like /blog/post-name break if the path isn't kept or mapped.
  • Missing http or www variants. Test all four combinations, plus HTTPS on the old domain.
  • Removing the redirect too soon. Keep it while the old URL still gets visits or has backlinks.

If a redirect still doesn't behave, see 301 redirect not working? 6 common causes and fixes.

Server config vs RedirHub#

A server rule and a redirect service both send a real 301. The difference is what you have to run and look after around it:

Server config (.htaccess, Nginx)RedirHub
Where it runsYour web server, wherever it's hostedServed from 130 global edge locations (PoPs), close to each visitor
Hosting for the old domainRequired, the server must stay onlineNot needed; DNS and email stay where they are, only the root and www records change
HTTPS on the old domainYou install and renew a certificateIssued and renewed automatically for the root and www
PathsWritten as rewrite rulesKeep the path, or map each old URL to its own new page; CSV import on every plan
Many domainsEdit config for each oneSeveral source domains per redirect, all in one dashboard
Redirect typesAny status code you write301, 302, 307, 308 and frame
VisibilityRaw server logsClicks and unique visitors with bots filtered out, top links per domain, DNS re-checked every 10 minutes
PriceFree with your hostingFrom $49/month (Core, 25 domains), 14-day free trial

RedirHub fits best when a domain no longer has a website behind it: a rebrand, a retired product, or a website migration where hundreds of old URLs each need their own destination, which you can load with a bulk CSV import. Every domain you connect gets automatic HTTPS, so https:// links to the old domain redirect without a certificate warning.

If the old URL lives on a server you already run and you're comfortable editing its config, a few lines in .htaccess or Nginx are free and work well. A redirect service earns its place when there's no server left to keep, when you handle many domains, or when you'd rather not maintain certificates for domains that only redirect.

Sources

  1. [1]Google Search Central: Redirects and Google Search
  2. [2]Apache mod_alias documentation
  3. [3]nginx ngx_http_rewrite_module documentation
  4. [4]Redirection plugin on WordPress.org
  5. [5]Search Engine Land, July 2016
  6. [6]Google Search Central: Site moves with URL changes

Frequently asked questions

A 301 redirect is a permanent forwarding address for a URL. Anyone who visits the old address, including search engines, is sent automatically to the new one, and search engines start showing the new address instead.

It's the full name of the HTTP 301 status code. The server is saying the page now lives at the address in the Location header and won't come back to the old one, so browsers and search engines should use the new address from now on.

They keep the old URL's backlinks and ranking signals working for the new URL. Without one, the old address returns a 404, those links stop counting and visitors from bookmarks or search results hit an error page.

Yes. Google treats permanent server-side redirects as passing the old URL’s ranking signals, as long as the destination is a relevant replacement and the redirect points straight at it without a chain.

Use a 301 when the old URL should stop existing. Use a canonical tag when several versions of a page must stay reachable and you only want one of them indexed.

Run curl -sI with the old URL, or use an online redirect checker. The first line of the response shows the status code; it should be 301 (or 308), and the location header should be the final page.

A redirect in your server config works as soon as the config is reloaded. One that depends on DNS changes, like registrar forwarding or a redirect service, works once the new records are picked up, often within minutes and sometimes up to a day. Search results update more slowly as Google recrawls the old URLs.

Keep it in place permanently, or at least for as long as the old URL still gets visits or has backlinks. Google recommends keeping redirects after a site move for at least a year. Removing it early turns those visits into 404 errors and throws away the ranking signals it was passing.

Yes, by deleting or changing the rule. Browsers cache 301 redirects aggressively, though, so returning visitors may keep being redirected for a while. Use a 302 while you are still testing a move.

RedirHub answers for your old domain at the DNS level, so you can create 301 redirects without a server. You choose the redirect type and whether paths are kept, HTTPS is issued automatically, and the dashboard shows clicks per domain so you can see when an old domain stops getting visitors.

Trinayan Chakraborty

TC is the Operations Manager at RedirHub, leading the company’s operational strategy and execution to ensure reliable, scalable redirect infrastructure. He oversees internal processes, cross-team coordination, and platform readiness while supporting customers through complex redirect implementations. With a strong understanding of large-scale domain operations and real-world edge cases, TC plays a key role in aligning product and customer success to deliver stable, high-performance redirection solutions.