⚙️

Htaccess Generator

Generate .htaccess rules

Frequently Asked Questions

What is an .htaccess file?

An .htaccess file configures Apache web server behavior for a directory. It controls URL redirects, access restrictions, caching, compression, custom error pages, and more. Changes take effect immediately without restarting Apache.

How do I create a 301 redirect with .htaccess?

The generator creates redirect rules: Redirect 301 /old-page /new-page for single pages, or RewriteRule patterns for complex redirects. 301 redirects pass SEO value to the new URL and are the recommended method for permanent moves.

How do I enable GZIP compression?

The generator creates mod_deflate rules that compress HTML, CSS, JavaScript, and other text files before sending to browsers. This typically reduces transfer size by 60-80%, significantly improving page load speed.

How do I set up browser caching?

The generator creates mod_expires rules that tell browsers how long to cache different file types. Images: 1 year, CSS/JS: 1 month, HTML: 1 hour. Proper caching reduces server load and speeds up repeat visits.

How do I force HTTPS with .htaccess?

The generator creates a RewriteRule that redirects all HTTP requests to HTTPS: RewriteCond %{HTTPS} off, RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]. This ensures all traffic is encrypted.