.htaccess Redirect Generator — 301, www, Force HTTPS

Developer

An .htaccess redirect generator produces ready-to-paste Apache snippets for individual 301/302 redirects, www/non-www host canonicalization, and HTTP-to-HTTPS enforcement.

What is it

.htaccess is the per-directory configuration file of the Apache web server, where redirects are declared with the mod_alias Redirect directive or mod_rewrite RewriteRule. This tool generates individual old-path-to-new-URL redirects (301 permanent or 302 temporary), host canonicalization to www or non-www, and forced HTTPS rules. The snippets are Apache-specific; Nginx and other servers use different syntax.

single: Redirect 301 /old /new · forced: RewriteCond condition + RewriteRule ^ target [R=301,L]

How to use

  1. 1Pick the redirect type (individual, www, HTTPS).
  2. 2Enter the path list or your domain and choose 301 or 302.
  3. 3Copy the snippet into the .htaccess at your site root and verify with the redirect checker.

Reference

.htaccess Redirect Generator — 301, www, Force HTTPS Reference
CaseCodeMethod
permanent page move301Redirect 301 /old-page /new-page
temporary move (test, campaign)302Redirect 302 /old-page /new-page
force HTTP → HTTPS301RewriteCond %{HTTPS} !=on + RewriteRule
www ↔ non-www canonical host301RewriteCond %{HTTP_HOST} + RewriteRule

Sources & standards

FAQ

Are my paths or domain sent to a server?

No. Snippet generation runs in your browser only; nothing you type is transmitted.

What is the difference between 301 and 302?

A 301 is a permanent move that transfers link signals to the new URL, while a 302 is temporary and keeps the original URL indexed. Use 301 when the address change is final.

Why does my .htaccess rule not work?

.htaccess only applies to Apache, and requires AllowOverride to be enabled plus the mod_rewrite module loaded. Nginx and Caddy need different configuration syntax.

Related tools