RevealTheme logo

.htaccess Snippet Generator

Generate common .htaccess rules — force HTTPS, redirect www, set cache headers, enable Gzip.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

What is .htaccess Snippet Generator?

.htaccess is Apache's per-directory configuration file. It controls URL rewriting, redirects, caching, compression, and security headers. Hostinger and most shared hosts use Apache (or LiteSpeed, which is compatible). These snippets cover the most common needs.

Frequently asked questions

Does .htaccess work on Nginx?
No — Nginx uses its own configuration syntax. These snippets are Apache/LiteSpeed only.
Where do I put .htaccess?
The root of your site (alongside index.html). Rules apply to that directory and all subdirectories.

Related tools