.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
- Enter your domain and choose HTTPS and www rules.
- List any old pages and their new URLs.
- 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 →- HTTP Status Codes Look up what an HTTP status code means and what usually causes it.
- Robots.txt Generator Generate a correct robots.txt for your website in seconds.
- Screen & Browser Info Quickly find your screen size, viewport, device pixel ratio and other details that web developers and support teams ask for.
- Link Preview Checker Check how a page or bio link will appear when shared, and fix titles and images before your audience sees them.
- Favicon Checker Find out which favicon and app icon files a website provides.
- Meta Tag Generator Create every meta tag a page needs for search results and social sharing, with live previews of how it will look.