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/
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 RedirectsEasy to manage without code.
JavaScript (Not Recommended)
// Avoid for SEO window.location.href = "/new-page/";// Google may not follow JS redirects. // Use server-side redirects instead.
Meta Refresh (Not Recommended)
<!-- Avoid for SEO --> <meta http-equiv="refresh" content="0;url=/new-page/" /><!-- Not treated as 301 by Google -->
Common Mistakes
1. Using 302 When 301 Needed
Mistake: 302 redirect for permanent URL changeImpact:
- Link equity not transferred
- Old URL stays in index
- SEO loss
Fix: Change to 301.
2. Redirect Chains
Bad: A β B β C β DImpact:
- Slow page load
- Link equity loss
- Crawl budget waste
Fix: A β D (direct)
3. Redirect Loops
Bad: A β B β AImpact:
- 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 302Curl 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 FrogCheck redirect type and chains.
Monitoring Redirects
Google Search Console
Coverage report: - Check "Redirected" pages - Look for errors - Monitor indexed pagesMake sure redirects working.
Crawl Tool
Screaming Frog: Response Codes tab β 3xxFind:
- 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 GSCCommon 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 .htaccessImplementation: β 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.
Ditulis oleh
Hendra Wijaya