Skip to content

.htaccess Redirect Builder

Generate error-free Apache .htaccess code for 301 redirects, HTTPS enforcement, and canonical URL routing.

Updated

What is the .htaccess Redirect Builder?

How it works

Examples

Simple Page Migration (301 Redirect)

Match Type: Exact, Source: /old-services, Target: /solutions, HTTP Code: 301
RewriteRule ^old-services$ /solutions [L,R=301,NC]

Directory Prefix Routing

Match Type: Directory Prefix, Source: /blog, Target: https://blog.example.com, HTTP Code: 301
RewriteRule ^blog(.*)$ https://blog.example.com/$1 [L,R=301,NC]

Global HTTPS Enforcement

Force global secure protocol (HTTP to HTTPS) enabled in Global Options.
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Frequently asked questions