.htaccess Redirect Generator
Build Apache .htaccess 301 permanent and 302 temporary URL redirection rules visually.
RewriteEngine On Redirect 301 /old-page https://example.com/new-page
About .htaccess Redirect Generator
The .htaccess Redirect & Rewrite Generator creates production-ready Apache web server configuration rules. Generate 301 Permanent Redirects, 302 Temporary Redirects, Force HTTPS SSL rewrites, WWW to Non-WWW rules, custom 404 error pages, and directory index protection.
How to Use .htaccess Redirect Generator
Step 1
Select the redirect type (301 Permanent, 302 Temporary, Force HTTPS, WWW Canonicalization).
Step 2
Enter the source URL path and target destination URL.
Step 3
Inspect the generated Apache mod_rewrite directives.
Step 4
Click "Copy .htaccess" or "Download .htaccess" and place the file in your Apache web root.
Practical Use Cases for .htaccess Redirect Generator
Website Migration & URL Restructuring
Generate 301 Permanent Redirect rules to preserve SEO link equity when changing page URLs or migrating domains.
SSL / HTTPS Security Enforcement
Force all HTTP traffic to redirect automatically to secure HTTPS with 1-click RewriteEngine rules.
Domain Canonicalization
Redirect all www.example.com requests to example.com (or vice versa) to prevent duplicate content issues.
Input & Output Examples
Generating 301 Redirect for Old URL
Old Path: /old-page, New URL: https://example.com/new-page
Redirect 301 /old-page https://example.com/new-page
Key Features & Performance
- ✓Generates 301 Permanent and 302 Temporary URL redirect rules.
- ✓Force HTTPS (SSL) redirect rules using mod_rewrite.
- ✓WWW to Non-WWW (or Non-WWW to WWW) domain canonicalization rules.
- ✓Custom ErrorDocument rules (404 Not Found, 500 Internal Error).
- ✓Disable directory browsing (Options -Indexes) for server security.
- ✓1-Click Copy and 1-Click .htaccess file download.
Key Terminology & Definitions
.htaccess File
A directory-level configuration file supported by Apache web servers that allows decentralized management of server behavior and rewrites.
301 Permanent Redirect
An HTTP response status code indicating that a requested resource has been permanently moved to a new canonical URL, transferring 90-99% of SEO ranking power.
