2025-01-22 23:36:03 +01:00

42 lines
1.6 KiB
ApacheConf

# Apache configuration file (see https://httpd.apache.org/docs/current/mod/quickreference.html)
# Allow access to all resources by default
Require all granted
# Disable directory listing for security reasons
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# Enable pretty URLs (removing the need for "index.php" in the URL)
<IfModule mod_rewrite.c>
RewriteEngine On
# Uncomment the next line if you want to set the base URL for rewrites
# RewriteBase /
# Force usage of HTTPS (secure connection). Uncomment if you have SSL setup.
# RewriteCond %{HTTPS} !on
# RewriteRule .? https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Permit requests to the '.well-known' directory (used for SSL verification and more)
RewriteRule ^\.well-known/.* - [L]
# Block access to hidden files (starting with a dot) and URLs resembling WordPress admin paths
RewriteRule /\.|^\.|^wp-(login|admin|includes|content) - [F]
# Return 404 for missing files with specific extensions (images, scripts, styles, archives)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(pdf|js|mjs|ico|gif|jpg|jpeg|png|webp|avif|svg|css|rar|zip|7z|tar\.gz|map|eot|ttf|otf|woff|woff2)$ - [L]
# Front controller pattern - all requests are routed through index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
# Enable gzip compression for text files
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/json application/xml application/rss+xml image/svg+xml
</IfModule>