.htaccess Generator
Generate Apache .htaccess rules for redirects, auth and more
.htaccess Generator builds Apache .htaccess rules from the options you choose — forcing HTTPS, adding or removing a www prefix, custom redirects, HTTP basic auth, and custom error pages — ready to drop into your site's root directory.
How to use .htaccess Generator
- 1
Choose which rules you need (force HTTPS, www redirect, etc.).
- 2
Fill in any specifics, like custom redirect paths or error page URLs.
- 3
Click "Generate" to build the rules.
- 4
Copy the result into your .htaccess file.
Everything you need to know about .htaccess files
What is .htaccess for?
A .htaccess file lets an Apache web server apply configuration — redirects, password protection, custom error pages, caching rules — on a per-directory basis, without needing access to the server's main configuration file.
When you actually need this
- Setting up redirects (e.g. forcing https, or www to non-www) on Apache hosting.
- Password-protecting a directory without building application-level authentication.
- Custom error pages for 404s or other status codes.
This only applies to Apache
If your site runs on Nginx, Vercel, or another non-Apache platform, .htaccess rules simply won't be read at all — the equivalent configuration lives elsewhere (an nginx.conf, a vercel.json, etc.) for those platforms.
Related Developer Tools
JSON Formatter
Format, validate and beautify JSON with syntax highlighting
JSON Minifier
Minify and compress JSON by removing whitespace
JSON Viewer
Interactive tree view for exploring complex JSON data
XML Formatter
Format and validate XML documents
YAML Formatter
Format, lint and validate YAML files
CSV to JSON
Convert CSV files or data to JSON format
Frequently Asked Questions
Does this only work on Apache servers?
Yes — .htaccess is an Apache-specific configuration mechanism. If you're on Nginx or another server, you'll need equivalent rules in that server's own config format instead.
Can I combine multiple rules, like forcing HTTPS and adding www at the same time?
Yes — select as many options as you need and they're all included together in the generated file.
What's the difference between adding and removing the www prefix?
Adding www redirects bare-domain requests to the www version; removing does the opposite, redirecting www requests to the bare domain. Pick whichever one matches your canonical domain.
Does this tool send my settings to a server?
Yes — they're sent to our servers to build the rules and the result is returned to you; nothing is stored.
Is this tool free to use?
Yes — completely free, with no signup required.