About .htaccess Generator
An .htaccess file is a per-directory configuration file read by the Apache web server on every request. This generator writes commonly used rules: a 301 redirect from HTTP to HTTPS, a redirect to or from the www host name, text compression with mod_deflate, cache lifetimes with mod_expires, a ban on directory listings, and a custom 404 document. Each block is wrapped in an IfModule test. It has no effect on Nginx or other servers.
How to use .htaccess Generator
- Fill in "Redirect HTTP to HTTPS", "www handling", "Compress text files" and "Cache static files in the browser", and the other options.
- The result appears below and updates as you type.
- Copy the result with the copy button, or download it as a file where that is offered.
Questions about .htaccess Generator
Where do I put the .htaccess file?
Upload it to the document root of the site, usually the public_html or www folder. The file name starts with a dot and has no extension. Rules apply to that folder and everything below it, provided the server allows overrides.
Runs in your browser. Page last updated .