Add .htaccess file for libraries directory with rewrite rules and security settings

This commit is contained in:
2026-02-25 23:55:59 +01:00
parent ab55be7410
commit 03114778b9
2 changed files with 145 additions and 148 deletions

30
libraries/.htaccess Normal file
View File

@@ -0,0 +1,30 @@
# /libraries/.htaccess
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
# 1) PRZEPUŚĆ cały katalog grid/ do jego własnego .htaccess
# (tu zatrzymujemy przetwarzanie reguł w tym pliku)
RewriteRule ^grid/ - [L]
RewriteRule ^filemanager-9.14.1/ - [L]
# 2) POZWÓL na pliki statyczne w całym /libraries
RewriteRule ^.*\.(css|js|map|mjs|png|jpe?g|gif|svgz?|webp|ico|woff2?|woff|ttf|eot|html?)$ - [L,NC]
# 3) ZABLOKUJ wszystkie pliki wykonywalne w /libraries (poza grid/, bo już wyszliśmy [L])
RewriteRule ^.*\.(php|phtml|phar|pht|cgi|pl|py|sh)$ - [F,NC]
# 4) WSZYSTKO inne → 403
RewriteRule ^ - [F]
</IfModule>
# Ukryte pliki (.env itp.) nie serwuj
<FilesMatch "^\.(.*)$">
Require all denied
</FilesMatch>
# Bezpieczeństwo MIME
<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
</IfModule>