.htaccess Generator
Generate a clean Apache .htaccess without memorizing the syntax. Flip on the rules you need, like forcing HTTPS, a www redirect, custom 301s or blocked IPs, and copy the file straight into your site root.
How to generate an .htaccess file
- Toggle the rules you want, such as force HTTPS, a www mode or caching.
- Add any custom redirects, blocked IP addresses or error pages.
- Copy the output or download the .htaccess file into your site root.
Examples
Force HTTPS and redirect an old page
forceHttps: true, redirect /old to /new (301)
# === Rewrite engine ===
RewriteEngine On
# === Force HTTPS ===
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# === Custom redirects ===
Redirect 301 /old /newBlock an IP and set a 404 page
blockIps: [203.0.113.5], errorPages: [404 -> /404.html]
# === Block IP addresses ===
<RequireAll>
Require all granted
Require not ip 203.0.113.5
</RequireAll>
# === Custom error pages ===
ErrorDocument 404 /404.htmlFrequently asked questions
What is an .htaccess file?
It is a per-directory configuration file for the Apache web server. You drop it in a folder to change how Apache handles requests there, for example to add redirects, block visitors or set caching, without editing the main server config.
Where do I put the .htaccess file?
Save it as a file named exactly .htaccess (with the leading dot and no extension) in the folder you want it to affect, usually the web root such as public_html. Rules apply to that folder and everything below it.
Why is my .htaccess being ignored?
Apache only reads .htaccess when AllowOverride is enabled for the directory and the relevant modules are loaded. Forcing HTTPS or www needs mod_rewrite, caching needs mod_expires, and compression needs mod_deflate. The blocks here are wrapped in IfModule so they fail safe if a module is missing.
Will this work on Nginx?
No. The .htaccess format is specific to Apache and compatible servers like LiteSpeed. Nginx does not read .htaccess files, so you would translate these rules into your server block instead.
What is the difference between a 301 and a 302 redirect?
A 301 is permanent and passes ranking signals to the new URL, so use it for moves that will stick. A 302 is temporary and tells browsers and search engines the original URL will return, so it does not pass the same authority.
Is my data sent to a server?
No. The file is generated entirely in your browser from the options you toggle, so nothing you type is uploaded anywhere.
Related tools
Redirect Checker
Paste a redirect map and see every chain mapped out, with loops, multi-hop chains, duplicate sources and temporary 302s flagged. Runs in your browser.
Gitignore Generator
Build a .gitignore from Node, Python, Java, Go, Rust, macOS, Windows and more. Pick your stacks, copy or download the file. Runs in your browser.
Robots.txt Generator
Create a valid robots.txt file in seconds. Pick allow all, block all, or custom rules, add your sitemap URL, then copy or download the file.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.