60 lines
1.9 KiB
ApacheConf
60 lines
1.9 KiB
ApacheConf
# Enable RewriteEngine
|
|
RewriteEngine On
|
|
RewriteBase /
|
|
|
|
|
|
# Add trailing slash to URLs (except files and directories)
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteCond %{REQUEST_URI} !/$
|
|
RewriteRule ^(.+)$ $1/ [L,R=301]
|
|
|
|
# Handle 404 errors
|
|
ErrorDocument 404 /404
|
|
|
|
# Rewrite pretty URLs to index.php?page=
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteRule ^([^/]+)/$ index.php?page=$1 [L,QSA]
|
|
|
|
# Enable GZip compression
|
|
<IfModule mod_deflate.c>
|
|
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
|
|
AddOutputFilterByType DEFLATE application/javascript application/json
|
|
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
|
|
AddOutputFilterByType DEFLATE application/font-woff application/font-woff2
|
|
AddOutputFilterByType DEFLATE image/svg+xml image/webp
|
|
</IfModule>
|
|
|
|
# Enable browser caching for static assets
|
|
<IfModule mod_expires.c>
|
|
ExpiresActive On
|
|
ExpiresByType image/jpeg "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 image/x-icon "access plus 1 year"
|
|
ExpiresByType application/font-woff "access plus 1 year"
|
|
ExpiresByType application/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 "DENY"
|
|
Header set X-XSS-Protection "1; mode=block"
|
|
</IfModule>
|
|
|
|
# Prevent directory listing
|
|
Options -Indexes
|
|
|
|
# BEGIN cPanel-generated php ini directives, do not edit
|
|
<IfModule php8_module>
|
|
php_value output_buffering Off
|
|
</IfModule>
|
|
<IfModule lsapi_module>
|
|
php_value output_buffering Off
|
|
</IfModule>
|
|
# END cPanel-generated php ini directives, do not edit |