Htaccess Generator
Build common Apache directives for HTTPS, canonical hostnames, trailing slashes, error pages, compression, caching and hotlinks.
Build an htaccess file
Blocks included: 0
Summary: -
How to use the Htaccess Generator
- Choose the canonical hostname and trailing slash policy for your site.
- Tick the directive blocks you want, such as HTTPS forcing, compression, caching and hotlink protection.
- Click Build htaccess, copy the file and upload it to your site root.
Features
- HTTPS forcing and www or non-www canonicalisation
- Trailing slash add or remove rules
- Compression, caching and custom error pages
- Directory listing control and hotlink protection
Advertisement
Frequently Asked Questions
Common questions about the free online htaccess generator.
It is a per-directory configuration file for Apache that changes rewrite, caching,
compression and access behaviour without editing the server config.
Pick your canonical hostname and trailing slash policy, tick the blocks you need, then click
Build htaccess and copy the file.
Enable the HTTPS option. The generator adds a rewrite condition on the HTTPS variable and a
permanent redirect to the secure address.
Either works for search engines. Choose one, redirect the other, and keep internal links
consistent with your choice.
Two addresses for the same page split ranking signals, so pick one form and redirect the
other permanently.
It rejects image requests whose referrer is another site, which stops others from serving
your files on their pages.
Yes. The caching block is wrapped in a module check, so nothing breaks on servers without
mod_expires loaded.
It uses a little CPU per response but saves far more bandwidth. Pre-compressed assets at the
edge are even cheaper.
Upload it as .htaccess in your site root, or in a subdirectory when the rules should only
apply there.
Restore the previous file immediately. A single syntax error in htaccess returns a server
error for every request.
Last updated: October 10, 2026