.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?▼
Where do I put .htaccess?▼
Related tools
Password Generator
Generate secure random passwords.
WordPress Username Generator
Generate secure WordPress usernames.
Domain Name Generator
Generate available-looking domain name ideas.
Business Name Generator
Generate brandable business name ideas.
URL Slug Generator
Convert text to URL-friendly slugs.
Lorem Ipsum Generator
Generate placeholder text in paragraphs, words, or bytes.