-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.htaccess
More file actions
executable file
·55 lines (47 loc) · 1.43 KB
/
.htaccess
File metadata and controls
executable file
·55 lines (47 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Installer .htaccess - Protezione Directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /installer/
# Block access if .installed file exists (allow ?force parameter for reinstall)
RewriteCond %{DOCUMENT_ROOT}/.installed -f
RewriteCond %{REQUEST_URI} !force [NC]
RewriteCond %{QUERY_STRING} !force [NC]
RewriteRule ^(.*)$ / [L,R=302]
# Allow access to assets (CSS, JS, images)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
# Prevent directory browsing
Options -Indexes
# Protect sensitive files
<FilesMatch "^\.">
Order allow,deny
Deny from all
</FilesMatch>
# Block access to database files specifically
<FilesMatch "^(schema|data|backup.*)\.(sql|sql\.gz)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</FilesMatch>
# Block direct access to PHP classes (except index.php)
<FilesMatch "\.php$">
<IfModule mod_authz_core.c>
<If "%{REQUEST_URI} !~ m#/index\.php$#">
Require all denied
</If>
</IfModule>
<IfModule !mod_authz_core.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !index\.php$
RewriteRule .* - [F,L]
</IfModule>
</FilesMatch>
# Set proper MIME types
AddType text/css .css
AddType application/javascript .js