Skip to content

Commit f989fb7

Browse files
committed
Refactor .htaccess to disallow direct php access in extensions.
1 parent 1fee6b5 commit f989fb7

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

.htaccess

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
11
# Disable directory listing
22
IndexIgnore *
33

4-
# Disable download of PmWiki extensions
5-
<Files "*.zip">
6-
<IfModule !mod_authz_host.c>
7-
Order Deny,Allow
4+
# Forbid download of compressed extensions and
5+
# direct access to extension scripts and wiki pages
6+
# Allow access to hub.php in the current directory
7+
<IfModule !mod_authz_host.c>
8+
Order Deny,Allow
9+
10+
<FilesMatch "^.*\.([pP][hH][pP]|[zZ][iI][pP])$">
11+
Deny from all
12+
</FilesMatch>
13+
14+
<If "%{REQUEST_URI} =~ m!wiki(lib|plain)\.d!">
815
Deny from all
9-
</IfModule>
10-
<IfModule mod_authz_host.c>
16+
</If>
17+
18+
<Files "hub.php">
19+
Allow from all
20+
</Files>
21+
22+
</IfModule>
23+
24+
<IfModule mod_authz_host.c>
25+
26+
<FilesMatch "^.*\.([pP][hH][pP]|[zZ][iI][pP])$">
1127
Require all denied
12-
</IfModule>
13-
</Files>
28+
</FilesMatch>
29+
30+
<If "%{REQUEST_URI} =~ m!wiki(lib|plain)\.d!">
31+
Require all denied
32+
</If>
33+
34+
<Files "hub.php">
35+
Require all granted
36+
</Files>
1437

38+
</IfModule>
1539

0 commit comments

Comments
 (0)