Redirects are HTTP responses that forward users from one URL to another. The main types are 301 (permanent), which passes link equity, and 302 (temporary) for short-term changes. Use 301 redirects for site migrations, URL changes, and domain consolidation. Avoid redirect chains and loops.
What Are Redirects?
A redirect tells browsers and search engines that a URL has moved to a new location. When encountered, the user is automatically sent to the new URL.
Redirect purposes:
- Move content to new URLs
- Consolidate duplicate pages
- Handle deleted pages
- Migrate to new domains
- Enforce HTTPS/www preferences
Types of Redirects
301 Redirect (Permanent)
Indicates the page has permanently moved.
Characteristics:
- Passes most link equity
- Browsers cache it
- Search engines update their index
- Original URL removed from index
Use for:
- URL changes
- Site migrations
- Domain changes
- Consolidating content
302 Redirect (Temporary)
Indicates a temporary move.
Characteristics:
- May not pass full link equity
- Not cached long-term
- Original URL kept in index
- Treated similarly to 301 by Google (but signals intent differently)
Use for:
- A/B testing
- Maintenance pages
- Geo-redirects
- Short-term promotions
307 Redirect (Temporary)
HTTP 1.1 version of 302, preserves request method.
Characteristics:
- Preserves POST requests
- Similar SEO impact to 302
- Used in HSTS redirects
308 Redirect (Permanent)
HTTP 1.1 version of 301, preserves request method.
Characteristics:
- Permanent like 301
- Preserves POST requests
- Less commonly used
Meta Refresh
HTML-based redirect (not recommended for SEO).
<meta http-equiv="refresh" content="0; url=https://example.com/new-page/">
Issues:
- Slower than server redirects
- May not pass full link equity
- Poor user experience
JavaScript Redirect
Client-side redirect (not recommended for SEO).
window.location.href = "https://example.com/new-page/";
Issues:
- Search engines may not follow
- Requires JavaScript
- Slower execution
Redirect Comparison
| Type | Use Case | Link Equity | SEO Status |
|---|---|---|---|
| 301 | Permanent changes | Passes | Recommended |
| 302 | Temporary changes | May pass | Use carefully |
| 307 | Temporary (POST) | May pass | Technical use |
| 308 | Permanent (POST) | Passes | Technical use |
| Meta refresh | Avoid | Partial | Not recommended |
| JavaScript | Avoid | Uncertain | Not recommended |
Implementing Redirects
Apache (.htaccess)
Single redirect:
Redirect 301 /old-page/ https://example.com/new-page/
Pattern redirect:
RedirectMatch 301 ^/blog/([0-9]+)/(.*)$ /blog/$2
Rewrite rule:
RewriteEngine On
RewriteRule ^old-page/?$ /new-page/ [R=301,L]
Nginx
Single redirect:
location /old-page/ {
return 301 https://example.com/new-page/;
}
Pattern redirect:
rewrite ^/blog/([0-9]+)/(.*)$ /blog/$2 permanent;
WordPress
Using .htaccess (above WordPress rules)
Using plugin:
- Redirection plugin (free, handles bulk imports)
- Yoast SEO (premium redirect manager)
- Rank Math (built-in redirect module)
Shopify
Use the URL Redirects section under Online Store > Navigation. Shopify handles redirects at the application level - no server config needed.
Cloudflare Page Rules
For sites behind Cloudflare, Page Rules can handle redirects at the edge before the request reaches your server. Useful for domain-level redirects and HTTPS enforcement.
JavaScript Frameworks
Next.js (next.config.js):
module.exports = {
async redirects() {
return [
{
source: '/old-page',
destination: '/new-page',
permanent: true,
},
];
},
};
Astro (astro.config.mjs):
export default {
redirects: {
'/old-page': '/new-page',
},
};
Common Redirect Scenarios
Domain Migration
Moving entire site to new domain.
# Old domain .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule (.*)$ https://newdomain.com/$1 [R=301,L]
HTTP to HTTPS
Forcing secure connection.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
WWW to Non-WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
Non-WWW to WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
Trailing Slash Enforcement
Add trailing slash:
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
Remove trailing slash:
RewriteCond %{REQUEST_URI} /.+/$
RewriteRule ^(.+)/$ /$1 [R=301,L]
Redirect Best Practices
Avoid Redirect Chains
Bad (chain):
Page A -> Page B -> Page C -> Page D
Good (direct):
Page A -> Page D
Page B -> Page D
Page C -> Page D
Avoid Redirect Loops
Loop:
Page A -> Page B -> Page A (endless loop)
Fix: Audit redirects before implementing. Screaming Frog catches loops during crawl.
Update Internal Links
After implementing redirects:
- Update all internal links to new URLs
- Reduce redirect dependence
- Improve page speed
Keep Redirects in Place
- Minimum 1 year
- Indefinitely for pages with backlinks
- Monitor for continued traffic
Match URL Components
# Preserve path structure
RewriteRule ^old/(.*)$ /new/$1 [R=301,L]
Redirect Problems
Common Issues
| Problem | Cause | Solution |
|---|---|---|
| Redirect chain | Multiple hops | Direct to final URL |
| Redirect loop | Circular reference | Audit and fix rules |
| Lost link equity | Wrong redirect type | Use 301 for permanent |
| Slow redirects | Too many redirects | Reduce redirect count |
Diagnosing Problems
Tools:
- Screaming Frog (crawl redirects, chain report)
- Chrome DevTools (Network tab)
- httpstatus.io (check individual URLs)
- Search Console (coverage errors)
Site Migration Redirects
Pre-Migration
- Crawl old site with Screaming Frog
- Map old URLs to new URLs
- Create redirect rules
- Test on staging
During Migration
- Implement redirects
- Update internal links
- Submit new sitemap
- Update Search Console
Post-Migration
- Monitor Search Console errors
- Check redirect functionality
- Monitor organic traffic
- Update external links where possible
See crawlability for migration best practices.
Redirect Checklist
Planning
- Old URLs documented
- New URLs mapped
- Redirect type selected (301/302)
- Rules tested on staging
Implementation
- Redirects implemented at server level
- Internal links updated
- Sitemap updated
- Search Console notified
Verification
- No redirect chains
- No redirect loops
- All redirects return correct status
- Critical pages accessible
Monitoring
- Search Console errors monitored
- Traffic monitored
- Redirects tested regularly
- Documentation maintained
Redirects preserve SEO equity during URL changes and site migrations. Use 301 for permanent changes, 302 for temporary ones. Server-level implementation performs best.
Avoid chains and loops - audit with Screaming Frog before and after deploying changes. Keep redirects in place long-term for pages with backlinks. Update internal links to reduce redirect dependence over time.
Combine redirect management with canonicalization and URL structure best practices for clean, crawlable technical SEO architecture.