Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Generate Apache .htaccess rules for www redirects, 301 redirects, error documents, IP deny/allow, hotlink protection, caching, password protection and more, right in your browser.
Redirects example.com to www.example.com.
Permanently redirect an old file or directory path to a new location.
Set browser cache expiration for static assets.
Block other sites from directly linking to your media files.
Require .htpasswd authentication to access a file.
Create an encrypted .htpasswd credential line. The result appears in the output below (it belongs in your .htpasswd file, not the .htaccess output).
Blacklist or whitelist specific IP addresses (comma separated).
Block known bad bots and scrapers by user agent.
Block direct access to the .htaccess file itself.
Set a custom page for each HTTP error code (leave blank to skip).
Set the default file served when a directory is requested.
Stop visitors from browsing a directory's contents when no index file is present.
# Choose options above to generate your .htaccess rules.An htaccess generator builds the configuration rules for an Apache .htaccess file from simple options, so you do not have to remember the exact syntax. Set up www and 301 redirects, error documents, IP deny/allow rules, a default directory page, directory listing rules, and additional options like blocking bad bots, preventing hotlinking, password protection, and caching. Everything, including the htpasswd hash, is generated in your browser, nothing is uploaded.
The generator covers the directives most sites need, so you can assemble a complete configuration without memorising Apache syntax. Each option maps to a well-formed rule block.
Beyond the rules themselves, the generator is designed to be fast, private, and copy-paste ready. These are the features that make it practical for daily use.
An .htaccess file handles many everyday server tasks, and this generator pairs well with the other free configuration and security tools from TestMu AI.
An .htaccess file is a configuration file for Apache web servers that controls settings like redirects, URL rewriting, access control, error documents, and caching on a per-directory basis.
Place the .htaccess file in the root directory of your website (usually public_html or www). It applies to that directory and all of its subdirectories.
No. The .htaccess rules and the htpasswd hash are generated entirely in your browser. Nothing you enter is uploaded, stored, or logged.
No. .htaccess is an Apache feature. Nginx uses its own configuration syntax and does not read .htaccess files.
Common causes are AllowOverride being set to None in the Apache config, the required module (such as mod_rewrite) being disabled, the file being named incorrectly, or a syntax error. Check the server error log first.
Apache reads .htaccess on every request in the directory tree, so very large rule sets can add slight overhead. For best performance, keep rules lean or move them into the main server config where possible.
Yes. Always copy your current .htaccess before replacing it. A single bad directive can return a 500 error for the whole directory, so a backup lets you roll back instantly.
Did you find this page helpful?
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance