Skip to content

Commit 7b9beb1

Browse files
authored
Merge pull request #454 from Geolim4/final
Updated htaccess generator code to be "Apache >= 2.4" compatible
2 parents a24094a + 0ff80d7 commit 7b9beb1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/phpFastCache/Core/PathSeekerTrait.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,19 @@ protected function htaccessGen($path, $create = true)
226226
}
227227

228228
if (!file_exists($path . "/.htaccess")) {
229-
$html = "order deny, allow \r\n
230-
deny from all \r\n
231-
allow from 127.0.0.1";
229+
$htaccess = "<IfModule mod_authz_host>\n
230+
Require all denied\n
231+
</IfModule>\n
232+
<IfModule !mod_authz_host>\n
233+
Order Allow,Deny\n
234+
Deny from all\n
235+
</IfModule>\n";
232236

233237
$file = @fopen($path . '/.htaccess', 'w+');
234238
if (!$file) {
235239
throw new phpFastCacheDriverException('PLEASE CHMOD ' . $path . ' - 0777 OR ANY WRITABLE PERMISSION!');
236240
}
237-
fwrite($file, $html);
241+
fwrite($file, $htaccess);
238242
fclose($file);
239243
}
240244
}

0 commit comments

Comments
 (0)