301 vs. 302 Redirects for SEO: Which Should You Use?

301 vs. 302 Redirects for SEO: Which Should You Use?

Joshua Hardwick
Joshua Hardwick
Head of Content @ Ahrefs (or, in plain English, I'm the guy responsible for ensuring that every blog post we publish is EPIC).
Article Performance
  • Organic traffic
    288
  • Linking websites
    64

The number of websites linking to this post.

This post's estimated monthly organic search traffic.

    The difference between 301 and 302 redirects is that 301 redirects are for permanent moves and 302 redirects are for temporary moves.

    You need to use the right one to avoid SEO issues.

    Let’s take a closer look at how these redirects work and when and how to use them.

    A 301 redirect is a permanent redirect. It takes visitors to the new URL and signals a permanent move to search engines. 

    You should use a 301 redirect when you:

    • Permanently change the URL of a webpage.
    • Permanently migrate to a new domain.
    • Switch from HTTP to HTTPS.
    • Want to fix non-www/www duplicate content issues.
    • Permanently merge two or more pages or websites.
    • Permanently change the URL structure of your website.

    A 302 redirect is a temporary redirect. It takes visitors to the new URL and signals a temporary move to search engines. 

    You should use a 302 redirect when you:

    • Want to redirect users to the right version of the site for them (based on location/language).
    • Want to A/B split-test the functionality or design of a webpage.
    • Want to get feedback about a new page without affecting the old page’s rankings.
    • Run a promotion and want to redirect visitors to a sales page temporarily.

    In other words, whenever you plan to bring back the old page after a short period. 

    Redirects impact which page ranks in the search results and how well it ranks. This is because if you redirect one URL to another, Google only indexes and shows one of them in the search results. It also usually combines link signals from both URLs at the one it indexes.

    There’s some nuance to how this works. Let’s take a closer look.

    How 301 redirects impact SEO

    301 redirects tell Google that a page has moved forever, so it almost always indexes and shows the new URL in the search results. After all, there’s no point keeping the old URL indexed if it’s never coming back.

    Google almost always indexes new URL when you use 301 redirect
    Sidenote.
    Redirects are a canonicalization signal, which is why they’re not 100% effective. Google may, in very rare cases, treat a 301 redirect as a 302 redirect.

    Link signals also usually consolidate “forward” to the new URL.

    Links consolidate “forward” to the new URL when you use a 301 redirect

    For example, say you redirect a page from site1.com/x to site2.com/x without changing the content. Link signals will consolidate at site2.com/x. In other words, if site1.com/x has 10 backlinks, site2.com/x feels the benefit of them as if they point directly to it. 

    It’s only if a redirect is irrelevant that this doesn’t happen because Google treats irrelevant redirects as soft 404s. 

    For example, say you redirect a blog post to your homepage. Google may not consolidate link signals because the two pages are entirely different. 

    Recommendation
    If you’re curious how Google is treating a 301 redirect, check whether links are consolidating to the new URL in Google Search Console. 

    Here’s how: 

    1. Open Google Search Console
    2. Go to Links > External Links > Top linked pages 
    3. Find the “new” URL in the report and click it (use the “Target page” filter to help)
    4. Filter the links by “Site” and paste in referring domains to the old page one by one (you can find these in the Referring Domains report in Ahrefs’ Site Explorer) 

    If you get no matches for several referring domains, Google is likely treating the redirect as a soft 404 and not counting the old page’s backlinks toward the new URL.

    If there is a match, click on the site to see the actual links. If you see the old URL in the “Target URL” column, Google is consolidating links at the new URL. 

    Top linking pages report in GSC

    How 302 redirects impact SEO

    302 redirects tell Google that a page has moved temporarily. So usually, it keeps the old URL indexed and shows it in the search results. After all, there’s no point in removing the old URL and indexing the new URL if the old URL will be back soon.

    Google almost always indexes the old URL when you use a 302 redirect

    Link signals also usually consolidate “backward” to the old URL.

    Links consolidate "backward" to the new URL when you use a 302 redirect

    Only if Google thinks you used a 302 redirect by mistake for a permanent move does this not happen. In that case, it treats the redirect as a 301. This means it indexes the new URL instead and consolidates link signals there. 

    Nobody knows how long a 302 redirect has to exist before Google starts treating it as a 301 redirect. Usually, it’s a few weeks to a few months, but it can be days, weeks, or months.

    In some circumstances, Google even appears to treat 302s as 301s from the get-go.

    For example, our Patrick Stox recently ran an experiment where he redirected (302) one established site to another. When Google saw the redirect, it dropped the old domain from the search results in favor of the “new” domain. 

    If you’re not sure how Google is treating one of your 302 redirects, paste the redirected URL into Search Console’s URL Inspection tool. If it shows the “URL is not on Google” warning, Google must be treating the redirect as permanent (301). If it is on Google, then Google’s treating it as temporary (302).

    URL Inspection tool

    Just make sure to check the last crawl date when doing this. If this date comes after you added the redirect, request reindexing and come back later.

    Sidenote.
    Google seems quicker to treat 302 redirects as permanent when redirecting to an established page or site. That’s likely because the new page or website has been around a while, so there’s a good chance you meant to redirect the URL permanently.

    It depends on how Google currently treats those redirects.

    If it’s figured things out and is already treating the accidental 302s as permanent moves, changing them to 301s may not impact anything. If it hasn’t figured things out, swapping the redirects from 302s to 301s is likely the best course of action.

    You can use the URL Inspection tool in GSC to check how Google treats individual URLs. Unfortunately, that’s pretty time-consuming if you have a lot of redirects. A faster method is to look for 302 redirects that get organic traffic. After all, that’s a telltale sign that Google still treats the redirect as temporary.

    You can do this by crawling your site with Ahrefs’ Site Audit and checking the Redirects report for the “302 redirects” warning.

    Redirects report in Ahrefs' Site Audit

    If it’s there, click to view the affected URLs and sort the report by “Organic traffic” from high to low.

    Affected URLs sorted by organic traffic. Data via Ahrefs' Site Audit

    As this data is an estimate, it’s worth double-checking redirected URLs with traffic in GSC’s URL Inspection tool. 

    If the user-declared and Google-declared canonicals match, Google treats the 302 redirect as permanent. 

    If they don’t, the redirected page is likely getting organic traffic because it’s still indexed, and Google treats it as temporary. That isn’t desirable if you used a 302 redirect accidentally for a permanent move. Luckily, swapping the 302 redirect to a 301 should fix the issue.

    You can create 301 and 302 redirects in several ways, but editing a website’s .htaccess file is the most common method. You’ll find this file in your website’s root directory.

    1 root directory .htaccess
    Sidenote.
    If you don’t see this file in your site’s root directory, either your server isn’t running on Apache, you don’t have this file, or it’s hidden. You can check the kind of server you’re running with this tool. If it’s Apache, the solution is to create a .htaccess file and upload it to your root server. If you’re running Nginx, read this. If you’re running Windows/IIS, read this.

    If you’re using WordPress, a less daunting option is to use a free SEO plugin to create redirects. RankMath has this functionality built in, but this plugin will also do the job.

    How to create a 301 redirect

    If you want to create a 301 redirect from one URL to another, add this to your .htaccess file:

    Redirect 301 /old-page.html /new-page.html 
    

    You can also do this using RankMath or the Redirections plugin. Just choose the type of redirect you want, then add your source and destination URLs.

    Page to create 301 redirect

    If you’re looking to redirect the entire website, add this to your .htaccess file:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^oldsite.com [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.oldsite.com [NC]
    RewriteRule ^(.*)$ https://newsite.com/$1 [L,R=301,NC]
    

    Just know that you’ll need to keep your old hosting active to redirect your site with .htaccess, which can be expensive. So it’s usually better to redirect through DNS. Most registrars allow you to select either a 301 or 302 redirect for this. If you’re using Google Domains, just hit Website > Add a forwarding address and then enter the new domain and choose “Permanent redirect.”

    Page to permanent redirect (301) in Google Domains

    You can learn how to create 301 redirects for more situations (e.g., non-www to www, HTTP to HTTPS) in our full guide to 301 redirects.

    How to create a 302 redirect

    If you want to create a 302 redirect from one URL to another, add this to your .htaccess file:

    Redirect 302 /old-page.html /new-page.html 
    

    You can also do this with RankMath or the Redirections plugin in WordPress:

    Page to create 302 redirect

    If you’re looking to redirect the entire website, use this code: 

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^oldsite.com [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.oldsite.com [NC]
    RewriteRule ^(.*)$ https://newsite.com/$1 [L,R=302,NC]
    

    Just know that you probably won’t want to use a 302 to redirect one site to another. Most domain changes are permanent, so you’ll want to use a 301. It’s the same story for redirects from HTTP to HTTPS or non-www to www (and vice versa).

    Final thoughts

    Redirects aren’t that complicated. If you’re moving content to a new location permanently, use a 301 redirect. If you’re moving it temporarily, use a 302 redirect. 

    That said, it’s reassuring to know that if you use the wrong type of redirect, Google will likely figure out what you meant sooner or later. Does this always happen? Of course not. Google isn’t always smart enough to realize what you meant every time, so it’s best practice to use the correct type of redirect where possible.

    Got questions? Ping me on Twitter.

    Article Performance
    • Organic traffic
      288
    • Linking websites
      64

    The number of websites linking to this post.

    This post's estimated monthly organic search traffic.

    代做工资流水公司福州流水单样本泰州做入职工资流水中山银行流水账打印哈尔滨工资流水单淄博制作转账流水德阳企业对私流水开具中山查背调工资流水揭阳公司银行流水价格湛江企业对私流水打印徐州银行流水模板福州个人流水模板合肥企业银行流水开具重庆流水单打印九江企业对公流水开具西宁工资银行流水多少钱郑州对公流水代开唐山代办离职证明苏州工资证明费用珠海打转账银行流水邯郸转账流水代开长沙办对公流水合肥查薪资流水单沈阳工资代付流水多少钱揭阳银行流水PS开具泰安代做转账银行流水盐城开入职工资流水襄阳工作收入证明多少钱天津打印银行流水账江门自存银行流水公司上饶车贷流水公司香港通过《维护国家安全条例》两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”19岁小伙救下5人后溺亡 多方发声卫健委通报少年有偿捐血浆16次猝死汪小菲曝离婚始末何赛飞追着代拍打雅江山火三名扑火人员牺牲系谣言男子被猫抓伤后确诊“猫抓病”周杰伦一审败诉网易中国拥有亿元资产的家庭达13.3万户315晚会后胖东来又人满为患了高校汽车撞人致3死16伤 司机系学生张家界的山上“长”满了韩国人?张立群任西安交通大学校长手机成瘾是影响睡眠质量重要因素网友洛杉矶偶遇贾玲“重生之我在北大当嫡校长”单亲妈妈陷入热恋 14岁儿子报警倪萍分享减重40斤方法杨倩无缘巴黎奥运考生莫言也上北大硕士复试名单了许家印被限制高消费奥巴马现身唐宁街 黑色着装引猜测专访95后高颜值猪保姆男孩8年未见母亲被告知被遗忘七年后宇文玥被薅头发捞上岸郑州一火锅店爆改成麻辣烫店西双版纳热带植物园回应蜉蝣大爆发沉迷短剧的人就像掉进了杀猪盘当地回应沈阳致3死车祸车主疑毒驾开除党籍5年后 原水城县长再被查凯特王妃现身!外出购物视频曝光初中生遭15人围殴自卫刺伤3人判无罪事业单位女子向同事水杯投不明物质男子被流浪猫绊倒 投喂者赔24万外国人感慨凌晨的中国很安全路边卖淀粉肠阿姨主动出示声明书胖东来员工每周单休无小长假王树国卸任西安交大校长 师生送别小米汽车超级工厂正式揭幕黑马情侣提车了妈妈回应孩子在校撞护栏坠楼校方回应护栏损坏小学生课间坠楼房客欠租失踪 房东直发愁专家建议不必谈骨泥色变老人退休金被冒领16年 金额超20万西藏招商引资投资者子女可当地高考特朗普无法缴纳4.54亿美元罚金浙江一高校内汽车冲撞行人 多人受伤

    代做工资流水公司 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化