.htaccess Redirect Generator

Create redirect rules for Apache web servers without memorising mod_rewrite syntax.

Runs in your browser. Nothing is uploaded Free, no sign-up Works on mobile
Domain
www
Page redirects: old-path new-URL (one per line)
Generated code
RewriteEngine On

# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Remove www
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301]

# Page redirects (301)
Redirect 301 /old-page /new-page
Redirect 301 /blog/2020/post /blog/post
Redirect 301 /services.html /services

For Apache servers with mod_rewrite (most shared hosting such as Hostinger, GoDaddy and Bluehost). Back up your existing .htaccess first. Use 301 for permanent moves so search rankings transfer.

How to use .htaccess Redirect Generator

  1. Enter your domain and choose HTTPS and www rules.
  2. List any old pages and their new URLs.
  3. Download .htaccess and upload it to your site’s root folder.

Frequently asked questions

What is the difference between a 301 and 302 redirect?

301 is permanent and passes search ranking to the new URL. 302 is temporary, for short-term moves.

Does this work on Nginx or Cloudflare?

No. .htaccess is only for Apache servers. Nginx uses server blocks, and Cloudflare uses Redirect Rules.

Related tools

All Web & SEO →