try to create the .htaccess
This commit is contained in:
parent
e937ad9b90
commit
0995fc8eea
29
install.php
29
install.php
|
@ -190,13 +190,28 @@ function checkSystem()
|
||||||
$stdOut = array();
|
$stdOut = array();
|
||||||
$dirpermissions = 0755;
|
$dirpermissions = 0755;
|
||||||
|
|
||||||
// Check .htaccess file for different webservers
|
// Try to create .htaccess file if not exists
|
||||||
if (!file_exists(PATH_ROOT.'.htaccess')) {
|
$htaccessContent = 'AddDefaultCharset UTF-8
|
||||||
|
|
||||||
if ( !isset($_SERVER['SERVER_SOFTWARE']) ||
|
<IfModule mod_rewrite.c>
|
||||||
stripos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false ||
|
|
||||||
stripos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false
|
# Enable rewrite rules
|
||||||
) {
|
RewriteEngine on
|
||||||
|
|
||||||
|
# Deny direct access to .txt files
|
||||||
|
RewriteRule ^bl-content/(.*)\.txt$ - [R=404,L]
|
||||||
|
|
||||||
|
# All URL process by index.php
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^(.*) index.php [PT,L]
|
||||||
|
|
||||||
|
</IfModule>';
|
||||||
|
|
||||||
|
if ( !file_exists(PATH_ROOT.'.htaccess') || (filesize(PATH_ROOT.'.htaccess')<1) ) {
|
||||||
|
if (!file_put_contents(PATH_ROOT.'.htaccess', $htaccessContent)) {
|
||||||
|
if (!empty($_SERVER['SERVER_SOFTWARE'])) {
|
||||||
|
$webserver = Text::lowercase($_SERVER['SERVER_SOFTWARE']);
|
||||||
|
if (Text::stringContains($webserver, 'apache') || Text::stringContains($webserver, 'litespeed')) {
|
||||||
$errorText = 'Missing file, upload the file .htaccess (ERROR_204)';
|
$errorText = 'Missing file, upload the file .htaccess (ERROR_204)';
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
|
|
||||||
|
@ -205,6 +220,8 @@ function checkSystem()
|
||||||
array_push($stdOut, $tmp);
|
array_push($stdOut, $tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Try to create the directory content
|
// Try to create the directory content
|
||||||
@mkdir(PATH_CONTENT, $dirpermissions, true);
|
@mkdir(PATH_CONTENT, $dirpermissions, true);
|
||||||
|
|
Loading…
Reference in New Issue