45 lines
1.8 KiB
ApacheConf
45 lines
1.8 KiB
ApacheConf
|
|
Options -Indexes
|
||
|
|
|
||
|
|
# Cache static assets
|
||
|
|
<IfModule mod_expires.c>
|
||
|
|
ExpiresActive On
|
||
|
|
ExpiresByType font/woff2 "access plus 3 months"
|
||
|
|
ExpiresByType font/woff "access plus 3 months"
|
||
|
|
ExpiresByType font/ttf "access plus 3 months"
|
||
|
|
ExpiresByType text/css "access plus 1 month"
|
||
|
|
ExpiresByType application/javascript "access plus 1 month"
|
||
|
|
ExpiresByType image/webp "access plus 1 month"
|
||
|
|
ExpiresByType image/png "access plus 1 month"
|
||
|
|
ExpiresByType image/jpeg "access plus 1 month"
|
||
|
|
ExpiresByType image/gif "access plus 1 month"
|
||
|
|
ExpiresByType image/svg+xml "access plus 1 month"
|
||
|
|
ExpiresByType image/x-icon "access plus 1 month"
|
||
|
|
</IfModule>
|
||
|
|
|
||
|
|
RewriteEngine On
|
||
|
|
|
||
|
|
# Redirect sitemap.xml to sitemap.php
|
||
|
|
RewriteRule ^sitemap\.xml$ sitemap.php [L,QSA]
|
||
|
|
|
||
|
|
# Block access to sensitive directories and files
|
||
|
|
RewriteRule ^config/ - [F,L]
|
||
|
|
RewriteRule ^data/ - [F,L]
|
||
|
|
RewriteRule ^cache/ - [F,L]
|
||
|
|
RewriteRule ^content/autosaves/ - [F,L]
|
||
|
|
RewriteRule ^content/layouts/ - [F,L]
|
||
|
|
RewriteRule ^content/functions\.php$ - [F,L]
|
||
|
|
RewriteRule ^.*\.md$ - [F,L]
|
||
|
|
RewriteRule ^content/images/.*\.ph(p[0-9]?|tml)$ - [F,L]
|
||
|
|
|
||
|
|
# To restrict /admin access by IP address, uncomment the RewriteCond and RewriteRule lines then replace 11\.22\.33\.44 with the public IP address to be allowed (backslashes need to remain - just replace the numbers). To add more than one IP, copy and paste the entire line, then change the IP.
|
||
|
|
# RewriteCond %{REMOTE_ADDR} !^11\.22\.33\.44$
|
||
|
|
# RewriteRule ^admin/ - [F,L]
|
||
|
|
|
||
|
|
# Allow direct access to existing files and folders
|
||
|
|
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
||
|
|
RewriteCond %{REQUEST_FILENAME} -d
|
||
|
|
RewriteRule ^ - [L]
|
||
|
|
|
||
|
|
# Everything else goes through the front controller
|
||
|
|
RewriteRule ^ index.php [L,QSA]
|