# Sample Apache .htaccess — samplefiles.com RewriteEngine On # Force HTTPS and strip www RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301] # Send everything that isn't a real file to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L] ExpiresActive On ExpiresByType image/webp "access plus 1 month" ExpiresByType text/css "access plus 1 week" AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json Options -Indexes RedirectMatch 403 ^/\.git