Canonical Tags and Duplicate Content: When and How to Use Them
Canonical tag explained: how Google handles duplicate content, when to use rel=canonical, code examples, store scenarios and mistakes to avoid.
Key takeaways
A 301 redirect is an HTTP response that tells browsers and crawlers a page has moved permanently to another address. A 302 redirect says the move is temporary. For SEO the difference matters: Google treats a 301 as a strong signal that the destination should be the canonical address, and a 302 as a weak one. The costly mistakes are choosing the wrong type and building redirect chains.
Any URL change, domain migration, switch to HTTPS or page removal calls for a redirect map. Done well, visitors and crawlers land on the right page and signals move with them. Done badly, you get 404s, “soft 404” pages and traffic losses that are hard to explain. This guide covers the differences between the codes, how to write the rules on your server and how to verify the result. Clean redirects are part of technical SEO, alongside canonical tags and sitemaps.
A redirect is a server response with a 3xx status code and a Location header pointing to where the client should go. These are the four codes you meet in SEO work:
| Code | Meaning | How Google treats it | When to use it |
|---|---|---|---|
| 301 | Moved permanently | Strong signal: the destination becomes canonical | URL change, migration, HTTPS, www |
| 308 | Moved permanently, keeps the method | Equivalent to 301 for Google | Same cases, when the HTTP method (POST) matters |
| 302 | Found, temporary | Weak signal: the source stays in the index | Promotions, tests, redirects by language or location |
| 307 | Temporary redirect, keeps the method | Equivalent to 302 | Same cases, for APIs and forms |
Beyond these there are meta refresh and JavaScript redirects. Google processes them, but the hierarchy is clear: server-side redirects are the most reliable, meta refresh comes next and JavaScript redirects are a last resort because they depend on rendering. An instant meta refresh is treated as permanent, a delayed one as temporary.
One detail that confuses debugging: if your site sends the HSTS header, the browser may handle the HTTP-to-HTTPS step itself, and in developer tools you will see “307 Internal Redirect.” That is not a configuration problem. It is browser behavior.
According to Google’s documentation, the indexing system uses a permanent redirect as a signal that the target should become the canonical address, so the destination usually appears in results. A temporary redirect is not used as a canonical signal, so the source page generally stays in the index while the destination may still be crawled.
Other useful reference points:
Pick by asking: “Will the old page come back?”
Use 301 or 308 when you:
www or non-www version, or a trailing-slash form;Use 302 or 307 when:
If you set a 302 by mistake and the move is actually permanent, Google may keep the old address for a long time. A practical rule: if you do not expect to reverse the move, use a 301.
The method depends on the server. These are the most common.
Apache (.htaccess). The first line moves a single page; the block after it forces HTTPS and the www version in one step:
Redirect 301 /old-services/ https://www.example.com/services/
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]nginx. The first block sends HTTP and the non-www host to HTTPS with www in one step; the second moves one page:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://www.example.com$request_uri;
}
location = /old-page/ {
return 301 /new-page/;
}WordPress. If you do not have server access, SEO plugins or dedicated redirect plugins manage the rules from the dashboard. Stick to one method; duplicate rules in a plugin and in .htaccess create chains. For a large set of addresses, our 301 redirect generator prepares the rules in the right format.
Every redirect is an extra request. For a visitor it means time lost before the page starts loading; for Googlebot, a request spent without new content. On a small site the effect is barely noticeable. On a store with tens of thousands of URLs, chains and redirects inside internal links can consume a visible share of crawl budget and delay the discovery of new pages.
On mobile, where connections vary, each hop adds to the time before first paint and therefore shows up in metrics such as LCP, covered in our guide to Core Web Vitals. The fix is always the same: one step between the old address and the final one, with menu, content and sitemap links pointing straight at the destination.
Stores have a specific problem: products come and go. For a discontinued product you have three options. If a near-identical replacement exists, use a 301 to it. If the stock-out is temporary, keep the page and signal availability. If the product is gone with no equivalent, a 404 or 410 page is more honest than a redirect to the category, and you can offer the category as a helpful link on the error page. General rules for categories and products are in our ecommerce SEO guide.
In a migration or restructure, the map decides how much traffic you keep.
The full procedure for moving a site is in our migration plan that avoids SEO losses.
Do not rely on what you see in the browser; it hides intermediate steps and may use cache. Check the headers:
curl -sIL https://example.com/old-page | grep -iE "^(HTTP|location)"The output shows each hop: the status code and the destination. A healthy redirect usually has one hop followed by a 200. For many addresses, a crawler (for example Screaming Frog) lists all redirects, chains and loops in one pass. In Search Console, URL Inspection shows the canonical Google selected and whether the page is indexed.
A redirect is not the answer to everything:
Good redirects are few, direct and documented. Start here:
curl -I and a crawler, then watch Search Console.If you are preparing a migration or have inherited a site with dozens of redirects, we can review it together as part of our technical SEO service or through the contact page.
Frequently asked questions
In practice a permanent redirect carries signals over to the new address, and Google uses it as a hint that the destination is canonical. The outcome still depends on how equivalent the content is: if the destination covers a different topic, the signals do not fit and you can lose visibility.
As long as you reasonably can. For site moves, Google’s guidance is to keep redirects as long as possible, generally at least a year, and external links and old bookmarks can keep sending visitors long after that. If a redirect costs you nothing, there is no reason to remove it; delete it only after checking it no longer receives traffic.
It is not recommended. For users and for Google, a homepage does not answer what they were looking for, and Google may treat such redirects as soft 404s. Redirect to the closest equivalent page. If none exists, return a 404 or 410 instead.
It is when A redirects to B and B redirects to C. Each hop adds delay and a chance of failure. Fixing it means updating the rule so A goes straight to C, and correcting internal links so they point to the final address.
Codes 307 and 308 preserve the HTTP method: a POST request stays a POST after the redirect, whereas with 301 and 302 some clients switch it to GET. For ordinary pages 301 and 302 are enough; 307 and 308 matter for APIs and form submissions.
Related service
Keep reading
Canonical tag explained: how Google handles duplicate content, when to use rel=canonical, code examples, store scenarios and mistakes to avoid.
Structured data schema in JSON-LD: which types are worth adding, code for an organization, article and product, how to validate and what Google retired.
Pages not indexed in Google Search Console: what each status means, how to find the cause and what to do, from noindex and canonicals to Crawled, not indexed.
Send us your website address and we’ll reply with a free initial analysis and a concrete SEO strategy — no strings attached.