online

.htaccess Generatoronline

Generate Apache .htaccess rules for redirects and security.

# Generated by ToolHQ .htaccess Generator
Options -Indexes

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Force HTTPS
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# Enable Gzip compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>

# Browser caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
</IfModule>

How to use .htaccess Generator

1

Enter Input

Type, paste, or upload your content.

2

Get Result

Result appears instantly in your browser.

3

Copy or Download

Copy the result or download your file.

Frequently Asked Questions

Related Tools