Generate .htaccess and added rewritebase

This commit is contained in:
Diego Najar 2018-03-04 21:43:30 +01:00
parent 2bc925cced
commit c59348ce98
4 changed files with 20 additions and 15 deletions

View File

@ -5,6 +5,9 @@ AddDefaultCharset UTF-8
# Enable rewrite rules
RewriteEngine on
# Base directory
RewriteBase /
# Deny direct access to .txt files
RewriteRule ^bl-content/(.*)\.txt$ - [R=404,L]

View File

@ -50,7 +50,6 @@ class Text {
'и'=>'i', 'й'=>'j', 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o','п'=>'p',
'р'=>'r', 'с'=>'s', 'т'=>'t', 'у'=>'u', 'ф'=>'f', 'х'=>'h', 'ц'=>'c', 'ч'=>'ch',
'ш'=>'sh', 'щ'=>'sh', 'ъ'=>'', 'ь'=>'j', 'ю'=>'yu', 'я'=>'ya',
// Ukrainian
'Є'=>'Ye', 'І'=>'I', 'Ї'=>'Yi', 'Ґ'=>'G',
'є'=>'ye', 'і'=>'i', 'ї'=>'yi', 'ґ'=>'g',

View File

@ -44,7 +44,7 @@ class pluginTinymce extends Plugin {
paste_as_text: true,
document_base_url: "'.DOMAIN_UPLOADS.'",
plugins: [
"autosave",
"autosave, code",
"searchreplace autolink directionality",
"visualblocks visualchars",
"fullscreen image link media template",
@ -52,7 +52,8 @@ class pluginTinymce extends Plugin {
"advlist lists textcolor wordcount",
"contextmenu colorpicker textpattern"
],
toolbar: "restoredraft | formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat image table | pagebreak code fullscreen"
toolbar1: "restoredraft | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | outdent indent | removeformat image | pagebreak code",
toolbar2: "formatselect | table | numlist bullist | fullscreen"
});
</script>';

View File

@ -190,7 +190,7 @@ function checkSystem()
$stdOut = array();
$dirpermissions = 0755;
// Try to create .htaccess file if not exists
// Try to create .htaccess
$htaccessContent = 'AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
@ -198,6 +198,9 @@ function checkSystem()
# Enable rewrite rules
RewriteEngine on
# Base directory
RewriteBase '.HTML_PATH_ROOT.'
# Deny direct access to .txt files
RewriteRule ^bl-content/(.*)\.txt$ - [R=404,L]
@ -207,22 +210,21 @@ 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)';
error_log($errorText, 0);
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)';
error_log($errorText, 0);
$tmp['title'] = 'File .htaccess';
$tmp['errorText'] = $errorText;
array_push($stdOut, $tmp);
}
$tmp['title'] = 'File .htaccess';
$tmp['errorText'] = $errorText;
array_push($stdOut, $tmp);
}
}
}
// Check mod_rewrite module
if (function_exists('apache_get_modules') ) {
if (!in_array('mod_rewrite', apache_get_modules())) {