SkyBrance Logo
SkyBrance
Menu
Free Tool

.htaccess Generator

Generate .htaccess configuration for Apache servers. Toggle common rules for HTTPS, compression, caching, security headers, and custom redirects.

Configuration Options

Custom Redirects

No custom redirects added.

.htaccess Output

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

# Enable GZIP Compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/json
    AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>

# Browser Caching
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType text/html "access plus 1 hour"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType application/x-font-woff "access plus 1 year"
    ExpiresByType font/woff2 "access plus 1 year"
</IfModule>

# Security Headers
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    Header set Permissions-Policy "camera=(), microphone=(), geolocation=()"
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
</IfModule>

# Prevent Directory Listing
Options -Indexes

About the .htaccess Generator

The .htaccess Generator is a free online tool that lets you generate Apache .htaccess rules for redirects and security. It runs entirely in your browser with no sign-up required, so you get instant results while your data stays on your device. It is built for developers, designers, and anyone who needs a fast, reliable .htaccess generator without installing software.

How to use the .htaccess Generator

  1. 1Open the .htaccess Generator and enter or paste your input.
  2. 2Adjust the available options to match what you need.
  3. 3View the result instantly as you work.
  4. 4Copy or download the output to use in your project.

Frequently asked questions

Is the .htaccess Generator free to use?

Yes. The .htaccess Generator is completely free with no account, sign-up, or installation required.

Is my data private when I use the .htaccess Generator?

This tool runs entirely in your browser. Your data is never uploaded to a server, which makes it safe to use with sensitive input.

Do I need to install anything?

No. The .htaccess Generator works in any modern web browser on desktop or mobile, with nothing to download.

Can I use the .htaccess Generator on mobile?

Yes. The tool is responsive and works on phones, tablets, and desktops.

Build more with SkyBrance

Beyond free tools, SkyBrance offers branded link shortening with real-time analytics and dynamic QR codes with scan tracking.