HTACCESS Redirect Generator
Easily generate .htaccess code snippets for 301, 302, and other common redirects.
How to use this tool
Enter each redirect pair in a separate row. For each redirect, provide the Old URL (where users are coming from) and the New URL (where they should be redirected to).
Example: If yoursite.com/old-about.html moved to yoursite.com/about:
Old URL: /old-about.html
New URL: /about
The tool generates redirects for your .htaccess file. Each redirect preserves your SEO rankings when moving pages.
301: SEO-friendly permanent redirect (most common) • 302: Temporary redirect • 307/308: Modern HTTP/1.1 equivalents
Common Redirect Templates
About .htaccess Redirects
The .htaccess file is a configuration file for Apache web servers that allows you to control redirects, URL rewrites, and other server behaviors without modifying the main server configuration.
Key Features
- 301 Redirects - Permanent (SEO-friendly)
- 302 Redirects - Temporary redirects
- SEO Preserved - Maintains rankings
- No Restart - Works immediately
Common Use Cases
- Moving pages to new URLs
- Domain migrations
- Fixing broken links
- Consolidating duplicate content
Important Notes
- Backup First: Always backup your .htaccess file before making changes
- Placement: Add redirect rules at the top of your .htaccess file
- Testing: Test redirects in incognito/private mode to avoid caching
- Old URLs: Must start with / for same-server redirects
- New URLs: Can be relative (/page) or absolute (https://example.com/page)
Redirect Type Reference
Was this result helpful?
Thank you for your feedback!
Your input helps us improve our tools.
Add more details about your experience
Help us fix issues with this tool