About this tool
Generate Apache .htaccess or Nginx rules for HTTPS, www or non-www, trailing slashes, 301 redirects, 404 pages, compression and caching.
Your choices are translated into the standard directives of each server: mod_rewrite conditions and Redirect 301 lines for Apache, server blocks with return 301 and location rules for Nginx. Redirect lines are checked before they are written.
Example: Server = Apache (.htaccess), Domain = example.com, Redirect HTTP to HTTPS = 1, Preferred host = Always www, Trailing slash = Do not change, 301 redirects (one per line: /old /new) = /old /new bad → Configuration = # Generated by 1CLIK — test on a staging copy first <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301] </IfModule> Redirect 301 /old /new ErrorDocument 404 /404.html , Redirect rules = 1.
Server configuration differs between hosts. Keep a backup and test the rules on a staging copy before using them on the live site.
Quick steps
- Fill in the fields you need — empty optional fields are left out.
- Press Generate (or Try an example to see how it works).
- Copy or download the result and paste it into your site.
Everything runs in your browser. Nothing you type is sent to 1CLIK.
FAQ
How does the .htaccess & Nginx Redirect Generator work?
Your choices are translated into the standard directives of each server: mod_rewrite conditions and Redirect 301 lines for Apache, server blocks with return 301 and location rules for Nginx. Redirect lines are checked before they are written.
What should I keep in mind?
Server configuration differs between hosts. Keep a backup and test the rules on a staging copy before using them on the live site.
Is my data sent anywhere?
No. What you type stays on your device; the page only shows the result.