📚 Table of Contents
⚠️ Common Error Patterns
🔄 Redirect Chain Problems
Problem: Multiple redirects in sequence causing slow loading
Example: URL A → URL B → URL C → Final URL
Example: URL A → URL B → URL C → Final URL
# Identify redirect chains
curl -L -v https://yourdomain.com/start-url 2>&1 | grep -E "(HTTP|Location)" | head -20
# Fix by creating direct redirects
# Instead of: /old → /intermediate → /new
# Use: /old → /new directly
# .htaccess fix
Redirect 301 /old-page /final-destination
# Remove intermediate redirects
🔃 Infinite Redirect Loops
Symptoms: ERR_TOO_MANY_REDIRECTS browser error
Common Causes: Conflicting rules, incorrect regex patterns, DNS issues
Common Causes: Conflicting rules, incorrect regex patterns, DNS issues
# Debug redirect loops
curl -L --max-redirs 5 -v https://yourdomain.com/problem-url
# Common .htaccess loop example (WRONG):
RewriteRule ^(.*)$ /$1 [R=301,L] # This redirects to itself!
# Fixed version:
RewriteRule ^old-page/?$ /new-page [R=301,L]
🚫 Soft 404 Errors
Soft 404: Page returns 200 status but shows "not found" content
Problem: Search engines can't distinguish between real content and error pages
Problem: Search engines can't distinguish between real content and error pages
# Wrong: Returns 200 but shows error message
<h1>Page Not Found</h1>
<p>Sorry, this page doesn't exist.</p>
# Correct: Return proper 404 status
<?php
http_response_code(404);
?>
<h1>Page Not Found</h1>
<p>Sorry, this page doesn't exist.</p>
📱 Mobile Redirect Issues
🔧 Common Mobile Problems
- Desktop users redirected to mobile site
- Mobile users stuck in redirect loops
- Tablet users getting wrong version
- App deep-links not working
✅ Mobile Redirect Best Practices
- Use responsive design instead of separate mobile site
- If using separate mobile site, ensure proper bidirectional linking
- Test with various device user agents
- Provide easy way to switch between versions
🌐 Browser Caching Issues
🧠 Understanding Browser Caching
301 Redirect Caching: Browsers permanently cache 301 redirects, meaning users might continue to be redirected even after you remove the redirect from your server.
🔧 Cache-Related Troubleshooting
- Identify Cache Issues
- Redirect works in incognito/private mode but not regular browsing
- Different browsers show different behavior
- New users don't experience the problem
- Server logs show correct response but user sees old behavior
- Clear Browser Cache Methods
- Hard refresh: Ctrl+F5 (Windows) or Cmd+Shift+R (Mac)
- Clear browsing data in browser settings
- Use developer tools to disable cache
- Test in different browsers or incognito mode
- Prevent Future Cache Issues
- Use 302 redirects for temporary changes
- Test redirects thoroughly before implementing 301s
- Communicate cache clearing to users when necessary
- Consider using different URLs for testing
🛠️ Cache Debugging Commands
# Check cache headers
curl -I https://yourdomain.com/page
# Test with cache-busting parameter
curl -I https://yourdomain.com/page?v=123
# Check if redirect is server-side or cached
curl -I --header "Cache-Control: no-cache" https://yourdomain.com/page
# Test with different user agents
curl -I -H "User-Agent: Mozilla/5.0" https://yourdomain.com/page
📋 Cache Removal Strategies
Real-World Scenario: You implemented a 301 redirect by mistake and need to remove it, but users' browsers are still cached.
- Immediate Actions
- Remove the redirect from server configuration
- Verify redirect is actually removed server-side
- Document the issue and timeline
- User Communication
- Create help page explaining cache clearing
- Send email to affected users if possible
- Post on social media with clear instructions
- Update customer service team with talking points
- Technical Workarounds
- Temporarily redirect the destination back to original
- Use JavaScript redirects as temporary fix
- Implement cache-busting parameters
- Monitor and track affected users
⚙️ Server Configuration Conflicts
🔧 Apache Configuration Issues
# Common .htaccess conflicts
# Problem: WordPress rules overriding custom redirects
# Solution: Place custom redirects BEFORE WordPress rules
# CORRECT ORDER:
RewriteEngine On
# Custom redirects first
Redirect 301 /old-page /new-page
# WordPress rules after
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
🌐 Nginx Configuration Problems
# Common Nginx issues
# Problem: Location block order affecting redirects
# Solution: More specific locations first
server {
# Specific redirects first
location /old-specific-page {
return 301 /new-specific-page;
}
# General patterns after
location ~ ^/old-category/(.*)$ {
return 301 /new-category/$1;
}
# Main location block last
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
☁️ CDN and Proxy Issues
🌍 Cloudflare Issues
- Page Rules Limits: Free plan limited to 3 rules
- Cache Interference: Cached responses overriding redirects
- SSL/TLS Settings: Conflicting with redirect rules
- Wildcard Patterns: Incorrect pattern matching
🔧 Resolution Steps
- Purge CDN cache after implementing redirects
- Check page rule priority and patterns
- Verify SSL/TLS mode compatibility
- Test from multiple geographic locations
🛡️ Security Plugin Conflicts
Common Conflict: Security plugins blocking or interfering with redirect functionality
- Wordfence blocking redirect attempts
- Sucuri WAF interfering with .htaccess rules
- Rate limiting preventing redirect testing
- IP blocking affecting redirect verification
# Debug security plugin interference
# Check if security plugin is blocking
# 1. Temporarily disable security plugin
# 2. Test redirects
# 3. If working, configure plugin to allow redirects
# Common Wordfence whitelist addition
# Dashboard → Wordfence → Firewall → Whitelisted URLs
# Add: /your-redirect-path/*
📈 Traffic Recovery Strategies
📊 Diagnosing Traffic Loss
Quick Assessment Questions:
- When did traffic start declining?
- Which pages are most affected?
- Are redirects returning correct status codes?
- Has search engine indexing changed?
- Are there increased 404 errors?
🔍 Investigation Process
- Analyze Traffic Patterns
- Compare traffic before and after redirect implementation
- Identify most affected pages and keywords
- Check organic vs. other traffic sources
- Analyze user behavior metrics (bounce rate, session duration)
- Search Console Analysis
- Review coverage report for errors
- Check performance data for affected keywords
- Monitor crawl stats for any anomalies
- Verify redirected URLs are being indexed
- Technical Validation
- Verify all redirects return proper 301 status
- Check that destination pages load correctly
- Ensure no redirect chains or loops
- Validate page speed and Core Web Vitals
⚡ Recovery Action Plan
🚨 Immediate Actions (Day 1)
- Fix any broken redirects immediately
- Submit updated sitemap to search engines
- Check and fix any 404 errors
- Verify destination pages are optimized
📈 Short-term Recovery (Week 1-2)
- Monitor search engine re-crawling
- Track ranking changes for target keywords
- Optimize destination pages for better performance
- Create content to support redirected pages
🎯 Long-term Strategy (Month 1-3)
- Build additional content around target keywords
- Acquire new backlinks to redirected pages
- Monitor and adjust redirect strategy
- Document lessons learned for future
📋 Recovery Monitoring Checklist
- Daily monitoring of traffic trends and search console errors
- Weekly ranking checks for affected keywords
- Bi-weekly competitor analysis to understand market changes
- Monthly performance review and strategy adjustment
- Quarterly redirect audit to optimize and clean up
🚨 Emergency Response Procedures
⚡ Crisis Response Framework
Definition of Emergency:
- Site-wide redirect failures causing 500 errors
- Traffic drop of >50% within 24 hours
- Complete loss of search engine rankings
- Infinite redirect loops affecting all users
🔧 Emergency Response Steps
- Immediate Assessment (0-15 minutes)
- Confirm the scope and severity of the issue
- Identify which redirects are causing problems
- Check server status and error logs
- Notify key stakeholders immediately
- Emergency Response (15-60 minutes)
- Disable problematic redirects
- Restore last known good configuration
- Verify site functionality is restored
- Implement temporary fixes if needed
- Stabilization (1-4 hours)
- Monitor system stability and user reports
- Analyze root cause in staging environment
- Develop proper fix for the underlying issue
- Plan implementation of permanent solution
- Recovery (4-24 hours)
- Implement tested fix in production
- Monitor for any remaining issues
- Update monitoring and alerting systems
- Conduct post-incident review
📱 Emergency Contact Procedures
# Emergency notification script
#!/bin/bash
INCIDENT_TYPE="Redirect Emergency"
SEVERITY="Critical"
AFFECTED_URLS="https://yourdomain.com/*"
CONTACT_LIST="[email protected],[email protected]"
# Send immediate alert
echo "CRITICAL: $INCIDENT_TYPE affecting $AFFECTED_URLS" | \
mail -s "URGENT: Website Emergency" $CONTACT_LIST
# Send to Slack
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"🚨 CRITICAL: $INCIDENT_TYPE\\nAffected: $AFFECTED_URLS\\nSeverity: $SEVERITY\"}" \
$SLACK_WEBHOOK_URL
🛠️ Emergency Rollback Procedures
# Quick rollback script
#!/bin/bash
# Backup current configuration
cp .htaccess .htaccess.backup.$(date +%Y%m%d_%H%M%S)
# Restore last known good configuration
if [ -f ".htaccess.lastgood" ]; then
cp .htaccess.lastgood .htaccess
echo "Rolled back to last good configuration"
else
# Emergency minimal .htaccess
cat > .htaccess << EOF
# Emergency minimal configuration
RewriteEngine On
# Add only essential redirects here
EOF
echo "Applied emergency minimal configuration"
fi
# Clear any caches
# Add cache clearing commands specific to your setup
📋 Post-Incident Review Process
- Incident Documentation
- Timeline of events and actions taken
- Root cause analysis and contributing factors
- Impact assessment (traffic, revenue, users affected)
- Response time and resolution time
- Process Improvement
- Identify what worked well and what didn't
- Update monitoring and alerting systems
- Improve testing and staging procedures
- Update emergency response procedures
- Prevention Measures
- Implement additional safeguards
- Update team training and documentation
- Review and test backup and recovery procedures
- Schedule regular redirect audits
Remember: The goal of emergency procedures is not just to fix the immediate problem, but to prevent similar issues in the future. Always conduct thorough post-incident reviews and implement improvements.