The .htaccess file configures Apache web server settings for your directory. Place the generated file at the root of your website. Always backup your existing .htaccess before replacing.
Basic Settings
Security
Redirects
No redirects added
Custom Error Pages
No error pages added
Custom Rewrite Rules
No rewrite rules added
Generated .htaccess
# Generated with the NEXINFINITY META .htaccess generator
# https://nexinfinitymeta.ai/tools/htaccess-generator
# Enable Rewrite Engine
RewriteEngine On
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Enable Gzip Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml
AddOutputFilterByType DEFLATE application/json application/ld+json
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE font/ttf font/otf font/woff font/woff2
</IfModule>
# Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 30 days"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "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 font/woff2 "access plus 1 year"
</IfModule>
# Prevent Directory Listing
Options -Indexes
# Hide Server Signature
ServerSignature Off
# Protect .htaccess
<Files .htaccess>
Require all denied
</Files>
# Security Headers
<IfModule mod_headers.c>
Header set X-Content-Type-Options "nosniff"
Header set X-Frame-Options "SAMEORIGIN"
</IfModule>