# Redirect Intelligence Report

**Generated:** {{formatDate generatedAt}}  
**Check ID:** `{{check.id}}`  
{{#if organization}}**Organization:** {{organization.name}} ({{organization.plan}}){{/if}}  
{{#if user}}**Generated by:** {{user.name}} ({{user.email}}){{/if}}

---

## Summary

| Metric | Value |
|--------|-------|
| **Input URL** | `{{check.inputUrl}}` |
{{#if check.finalUrl}}| **Final URL** | `{{check.finalUrl}}` |{{/if}}
| **HTTP Method** | `{{check.method}}` |
| **Status** | {{statusBadge check.status}} |
| **Total Redirects** | {{check.redirectCount}} |
| **Total Time** | {{formatDuration check.totalTimeMs}} |
| **Loop Detected** | {{#if check.loopDetected}}⚠️ Yes{{else}}✅ No{{/if}} |
| **Started** | {{formatDate check.startedAt}} |
| **Finished** | {{formatDate check.finishedAt}} |

{{#if check.error}}
> **⚠️ Error:** {{check.error}}
{{/if}}

---

## Redirect Chain

{{#if check.hops}}
### Visual Flow Chart

```mermaid
{{mermaidDiagram}}
```

### Hop Details

| # | URL | Status | Type | Latency | Content-Type |
|---|-----|--------|------|---------|--------------|
{{#each check.hops}}
| {{hopIndex}} | `{{formatUrl url 60}}` | {{#if statusCode}}{{statusCode}}{{else}}-{{/if}} | {{redirectType type}} | {{#if latencyMs}}{{latencyMs}}ms{{else}}-{{/if}} | {{#if contentType}}{{contentType}}{{else}}-{{/if}} |
{{/each}}

{{#if check.loopDetected}}
> **⚠️ Warning:** A redirect loop was detected in this chain. This can cause infinite redirects and poor user experience.
{{/if}}

{{else}}
*No redirect hops recorded.*
{{/if}}

---

## Analysis Results

{{#if analysis}}

### 🔒 SSL Certificate Analysis

{{#if analysis.ssl}}
{{#each analysis.ssl}}
**Host:** `{{host}}`

| Property | Value |
|----------|-------|
| **Days to Expiry** | {{#if daysToExpiry}}{{daysToExpiry}} days{{else}}N/A{{/if}} |
| **Issuer** | {{#if issuer}}{{issuer}}{{else}}N/A{{/if}} |
| **Protocol** | {{#if protocol}}{{protocol}}{{else}}N/A{{/if}} |

{{#if warningsJson}}
**Warnings:**
{{#each warningsJson}}
- ⚠️ {{this}}
{{/each}}
{{/if}}

---
{{/each}}
{{else}}
*No SSL analysis data available.*
{{/if}}

### 🔍 SEO Analysis

{{#if analysis.seo}}
| SEO Factor | Status |
|------------|--------|
| **Robots.txt** | {{analysis.seo.robotsTxtStatus}} |
| **Indexing** | {{#if analysis.seo.noindex}}🚫 No Index{{else}}✅ Indexable{{/if}} |
| **Following** | {{#if analysis.seo.nofollow}}🚫 No Follow{{else}}✅ Followable{{/if}} |
| **Sitemap** | {{#if analysis.seo.sitemapPresent}}✅ Present{{else}}❌ Not Found{{/if}} |

{{#if analysis.seo.noindex}}
> **⚠️ SEO Warning:** This page is marked as "noindex" and will not appear in search results.
{{/if}}

{{else}}
*No SEO analysis data available.*
{{/if}}

### 🛡️ Security Analysis

{{#if analysis.security}}
| Security Check | Result |
|----------------|--------|
| **Safe Browsing** | {{analysis.security.safeBrowsingStatus}} |
| **Mixed Content** | {{analysis.security.mixedContent}} |
| **HTTPS Downgrade** | {{#if analysis.security.httpsToHttp}}⚠️ Detected{{else}}✅ None{{/if}} |

{{#if analysis.security.httpsToHttp}}
> **🔒 Security Warning:** HTTPS to HTTP downgrade detected. This can expose sensitive data in transit.
{{/if}}

{{else}}
*No security analysis data available.*
{{/if}}

{{else}}
*No analysis results available for this check.*
{{/if}}

---

## Recommendations

{{#if_eq check.status "LOOP"}}
- **Fix Redirect Loop:** Review your redirect configuration to prevent infinite loops
- **Check Server Configuration:** Ensure proper redirect rules in your web server
- **Monitor Performance:** Redirect loops can severely impact site performance
{{/if_eq}}

{{#if check.loopDetected}}
- **Immediate Action Required:** Fix the redirect loop to prevent poor user experience
{{/if}}

{{#if analysis.security.httpsToHttp}}
- **Security Priority:** Ensure all redirects maintain HTTPS encryption
- **Update Configuration:** Modify server rules to prevent HTTPS downgrades
{{/if}}

{{#if analysis.seo.noindex}}
- **SEO Review:** Consider if this page should be excluded from search engines
{{/if}}

{{#if analysis.ssl}}
{{#each analysis.ssl}}
{{#if daysToExpiry}}
{{#if (lt daysToExpiry 30)}}
- **SSL Certificate:** Certificate expires in {{daysToExpiry}} days - plan renewal soon
{{/if}}
{{/if}}
{{/each}}
{{/if}}

### General Best Practices

1. **Minimize Redirects:** Each redirect adds latency - aim for direct links when possible
2. **Use 301 for Permanent:** Use HTTP 301 for permanent URL changes for better SEO
3. **Monitor Regularly:** Set up monitoring to catch redirect issues early
4. **Test Changes:** Always test redirect changes in staging before production
5. **Document Rules:** Keep track of your redirect rules for easier maintenance

---

## Technical Details

**Report Generated by:** [Redirect Intelligence v2](https://redirect-intelligence.com)  
**Analysis Engine:** Enhanced redirect tracking with SSL, SEO, and security analysis  
**Export Format:** Markdown Report  
**Mermaid Version:** 10.6.1  

---

*This report was automatically generated by Redirect Intelligence v2. For questions or support, please refer to the API documentation.*
