Salin dan Bagikan
Cara Redirect 301 dan 302: Kapan Menggunakan Masing-Masing - Pelajari perbedaan redirect 301 dan 302, kapan menggunakan masing-masing, dan cara implementasi yang …

Cara Redirect 301 dan 302: Kapan Menggunakan Masing-Masing

Redirect adalah cara memberitahu browser dan search engine bahwa URL telah berpindah. Memilih jenis redirect yang tepat penting untuk SEO.

Perbedaan 301 vs 302

301 Redirect (Permanent)

Artinya:
"Halaman ini PERMANENT pindah ke lokasi baru"

SEO Impact:
- Mentransfer link equity (~90-99%)
- Google updates index ke URL baru
- Bookmark users akan tetap work

Use when:
- URL change permanen
- Domain migration
- HTTPS migration
- Site restructure

302 Redirect (Temporary)

Artinya:
"Halaman ini SEMENTARA dialihkan"

SEO Impact:
- Link equity TIDAK ditransfer
- Google keeps original URL in index
- Temporary by design

Use when:
- A/B testing
- Maintenance mode
- Geolocation redirects
- Temporary promotions

Quick Comparison

+------------------+-------------+-------------+
| Aspect           | 301         | 302         |
+------------------+-------------+-------------+
| Duration         | Permanent   | Temporary   |
| Link equity      | Transfers   | No transfer |
| Google indexing  | New URL     | Old URL     |
| Cache            | Long        | Short       |
| Use case         | URL changes | Temp moves  |
+------------------+-------------+-------------+

Kapan Menggunakan 301

URL Change

Old: /old-page-name/
New: /new-page-name/

Setup 301 dari old → new.

Domain Migration

Old: oldsite.com/page
New: newsite.com/page

Redirect semua URLs dengan 301.

HTTP to HTTPS

http://example.com
→ https://example.com

Always use 301.

Site Restructure

Old structure:
/category/subcategory/page/

New structure:
/page/

301 redirect old to new.

Merging Pages

Thin content consolidation:
Page A + Page B + Page C
→ New comprehensive page

301 all old pages to new.

Kapan Menggunakan 302

A/B Testing

Original: /landing-page/
Test: /landing-page-v2/

302 temporarily redirect some users.
Switch back when done.

Maintenance

During maintenance:
/page/ → /maintenance/

Use 302 so original page returns to index.

Geolocation

/page/ → /page-id/ (for Indonesian users)
/page/ → /page-en/ (for English users)

302 because it's conditional, not permanent.

Seasonal Promotions

/sale/ → /summer-sale/

302 because it will change again.

Cara Implement Redirect

.htaccess (Apache)

# Single 301 redirect
Redirect 301 /old-page/ https://example.com/new-page/

# Pattern redirect
RedirectMatch 301 ^/blog/(.*)$ https://example.com/articles/$1

# 302 redirect
Redirect 302 /temp-page/ https://example.com/other-page/

Nginx

server {
    # Single 301
    location = /old-page/ {
        return 301 https://example.com/new-page/;
    }

    # Pattern 301
    location ~ ^/blog/(.*)$ {
        return 301 https://example.com/articles/$1;
    }

    # 302 redirect
    location = /temp/ {
        return 302 https://example.com/other/;
    }
}

WordPress (functions.php)

// 301 redirect
function my_redirects() {
    if (is_page('old-page')) {
        wp_redirect('/new-page/', 301);
        exit;
    }
}
add_action('template_redirect', 'my_redirects');

WordPress Plugins

Popular options:
- Yoast SEO Premium (built-in)
- Redirection (free)
- Safe Redirect Manager
- 301 Redirects

Easy to manage without code.
// Avoid for SEO
window.location.href = "/new-page/";

// Google may not follow JS redirects.
// Use server-side redirects instead.
<!-- Avoid for SEO -->
<meta http-equiv="refresh" content="0;url=https://www.tirinfo.com/new-page/" />

<!-- Not treated as 301 by Google -->

Common Mistakes

1. Using 302 When 301 Needed

Mistake:
302 redirect for permanent URL change

Impact:
- Link equity not transferred
- Old URL stays in index
- SEO loss

Fix:
Change to 301.

2. Redirect Chains

Bad:
A  B  C  D

Impact:
- Slow page load
- Link equity loss
- Crawl budget waste

Fix:
A  D (direct)

3. Redirect Loops

Bad:
A  B  A

Impact:
- Page won't load
- Crawl errors
- Users stuck

Fix:
Remove circular redirect.

4. Not Redirecting All Variations

Missing:
http://example.com/page/
http://www.example.com/page/
https://www.example.com/page/

All should redirect to canonical URL.

Testing Redirects

Browser DevTools

1. Open DevTools (F12)
2. Network tab
3. Visit old URL
4. Check Status Code column
5. Verify 301 or 302

Curl Command

curl -I https://example.com/old-page/

# Output shows:
HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page/

Online Tools

Options:
- httpstatus.io
- redirect-checker.org
- Screaming Frog

Check redirect type and chains.

Monitoring Redirects

Google Search Console

Coverage report:
- Check "Redirected" pages
- Look for errors
- Monitor indexed pages

Make sure redirects working.

Crawl Tool

Screaming Frog:
Response Codes tab → 3xx

Find:
- Redirect chains
- Wrong redirect types
- Missing redirects

Best Practices

Redirect Strategy:
✓ Use 301 for permanent changes
✓ Use 302 only for temporary
✓ Avoid chains (max 2 hops)
✓ Test after implementation
✓ Update internal links to new URLs
✓ Monitor in GSC

Common Redirects:
✓ non-www to www (or vice versa)
✓ HTTP to HTTPS
✓ Trailing slash consistency
✓ Old URLs to new structure

Redirect Checklist

Before redirect:
☐ Confirm it's needed
☐ Choose 301 or 302
☐ Document old and new URLs
☐ Backup .htaccess

Implementation:
☐ Add redirect rule
☐ Test redirect works
☐ Check status code
☐ Verify no chains

After redirect:
☐ Update internal links
☐ Update sitemap
☐ Monitor GSC for errors
☐ Check traffic to new URL

Kesimpulan

Gunakan 301 untuk perubahan permanen dan 302 untuk sementara. Kesalahan memilih bisa berdampak signifikan pada SEO. Test setiap redirect dan monitor hasilnya.

Artikel Terkait

Link Postingan : https://www.tirinfo.com/cara-redirect-301-302-seo/

Hendra WIjaya
Tirinfo
4 minutes.
7 January 2026