Instant • private • developer-friendly

.htaccess Generator

Toggle common Apache rules to build a ready-to-use .htaccess file for redirects, caching, compression and security.

Force HTTPSRedirect all HTTP requests to HTTPS.
Force wwwRedirect the bare domain to the www subdomain.
Force non-wwwRedirect the www subdomain to the bare domain.
Custom 404 pageServe a custom page for not-found errors.
Browser cachingSet long cache lifetimes for images, CSS and JS.
Gzip compressionCompress text-based responses to save bandwidth.
Disable directory listingPrevent visitors from browsing folder contents.
Hotlink protectionBlock other sites from embedding your images directly.

.htaccess

🔒 Your settings stay on your device and are never uploaded.

Configure Apache without memorizing directives

The .htaccess file controls redirects, caching, compression and access rules on Apache servers, but the mod_rewrite syntax is easy to get wrong. Toggle the rules you need here and copy a tested, ready-to-use file.

Common rules covered

HTTPS and www redirects, custom error pages, caching, gzip and basic security rules.

Conflict aware

www and non-www redirects cannot both be active, and the tool prevents that combination.

Private by design

The file is generated entirely in your browser. Nothing is uploaded.

htaccess generator FAQ

Where do I put the .htaccess file?

Place it in the root directory of your Apache-hosted website. It must be named exactly .htaccess, including the leading dot.

Does this work on Nginx?

No. .htaccess files only work on Apache servers or Apache-compatible configurations. Nginx requires different directives in its server block.

Do I need mod_rewrite enabled?

Yes, for the HTTPS and www redirect rules. Most shared hosting providers enable mod_rewrite by default.

Is my selection uploaded anywhere?

No. The file is generated entirely in your browser.