From 001cd411f2937d76dbc2cb0cbd5dbbd100960867 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Mon, 7 Nov 2016 09:16:10 +0000 Subject: [PATCH] Update .htaccess to support Apache 2.2. and 2.4 (#957) --- .htaccess | 73 ++++++++++++++++++++++++------------ application/hooks/db_log.php | 2 +- public/.htaccess | 35 ++++++++++++++--- 3 files changed, 81 insertions(+), 29 deletions(-) diff --git a/.htaccess b/.htaccess index 34194d237..e824912de 100755 --- a/.htaccess +++ b/.htaccess @@ -5,29 +5,56 @@ Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes # prevent folder listing IndexIgnore * -# secure htaccess file - - Order allow,deny - Deny from all - +# Apache 2.4 + + # secure htaccess file + + Require all denied + -# prevent access to PHP error log - - Order allow,deny - Deny from all - Satisfy all - + # prevent access to PHP error log + + Require all denied + -# prevent access to LICENSE - - Order allow,deny - Deny from all - Satisfy all - + # prevent access to LICENSE + + Require all denied + -# prevent access to csv and txt files - - Order allow,deny - Deny from all - Satisfy all - + # prevent access to csv, txt and md files + + Require all denied + + + +# Apache 2.2 + + # secure htaccess file + + Order allow,deny + Deny from all + Satisfy all + + + # prevent access to PHP error log + + Order allow,deny + Deny from all + Satisfy all + + + # prevent access to LICENSE + + Order allow,deny + Deny from all + Satisfy all + + + # prevent access to csv, txt and md files + + Order allow,deny + Deny from all + Satisfy all + + diff --git a/application/hooks/db_log.php b/application/hooks/db_log.php index 81445547c..04459d5d7 100644 --- a/application/hooks/db_log.php +++ b/application/hooks/db_log.php @@ -8,7 +8,7 @@ function db_log_queries() if($CI->config->item('db_log_enabled')) { // Creating Query Log file with today's date in application/logs folder - $filepath = APPPATH . 'logs/Query-log-' . date('Y-m-d') . '.log'; + $filepath = APPPATH . 'logs/Query-log-' . date('Y-m-d') . '.php'; // Opening file with pointer at the end of the file $handle = fopen($filepath, "a+"); diff --git a/public/.htaccess b/public/.htaccess index ae98319b7..20aeda3d8 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -24,11 +24,36 @@ RewriteRule ^(.*)$ index.php?/$1 [L] #Options All -Indexes Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes -# secure htaccess file - - Order allow,deny - Deny from all - +# prevent folder listing +IndexIgnore * + +# Apache 2.4 + + # secure htaccess file + + Require all denied + + # prevent access to PHP error log + + Require all denied + + + +# Apache 2.2 + + # secure htaccess file + + Order allow,deny + Deny from all + Satisfy all + + # prevent access to PHP error log + + Order allow,deny + Deny from all + Satisfy all + +