I have an .htaccess in my public_html directory with the following rules:
<IfModule litespeed>
php_flag zlib.output_compression On
php_value zlib.output_compression_level 2
php_value session.gc_maxlifetime 200000
php_flag display_startup_errors On
php_flag html_errors On
php_flag ignore_repeated_errors Off
php_flag ignore_repeated_source Off
php_flag report_memleaks On
php_flag track_errors On
php_value log_errors_max_len 0
php_flag display_errors Off
php_flag log_errors On
php_value error_log errors.log
php_value max_execution_time 600
php_value max_input_time 600
php_value max_input_vars 100000
</IfModule>
They are working fine, confirmed through phpinfo();
However, when I am placing .htaccess in a sub-directory, with rules that suppose to override the above, they are being completely ignored, and only the above rules are working.
For example, I have placed an .htaccess file in my public_html/admin directory, with the following rules
<IfModule litespeed>
php_value session.gc_maxlifetime 7200
php_flag display_errors On
</IfModule>
When checking phpinfo(); it shows that the values are still "200000" and "Off" instead of "7200" and "On" respectively.
Ok, after hours of debugging, it seems to be a Litespeed server bug:
To reproduce the issue:
add these lines to your .htaccess in the main dir (ie. http://website/)
<FilesMatch "\.(php)$">
deny from 207.14.19.21
</FilesMatch>
Then open up phpinfo in you sub-dir ((ie. http://website/subdir/). You will see that the sub-directory .htaccess can not override the PHP rules that were set in the .htaccess in the main dir.
By the way, the deny from 207.14.19.21 is just an example, you can put any rules you want instead, the issue is with the<FilesMatch "\.(php)$"> or any other FilesMatch that covers .php files (such as <FilesMatch "\.+$">)
You can even do:
<FilesMatch "\.(php)$">
order allow,deny
allow from all
</FilesMatch>
And it will cause the same issue.
P.S. This was originally discussed here:
https://www.litespeedtech.com/suppo...ng-ignored-in-sub-directory.13933/#post-93073
<IfModule litespeed>
php_flag zlib.output_compression On
php_value zlib.output_compression_level 2
php_value session.gc_maxlifetime 200000
php_flag display_startup_errors On
php_flag html_errors On
php_flag ignore_repeated_errors Off
php_flag ignore_repeated_source Off
php_flag report_memleaks On
php_flag track_errors On
php_value log_errors_max_len 0
php_flag display_errors Off
php_flag log_errors On
php_value error_log errors.log
php_value max_execution_time 600
php_value max_input_time 600
php_value max_input_vars 100000
</IfModule>
They are working fine, confirmed through phpinfo();
However, when I am placing .htaccess in a sub-directory, with rules that suppose to override the above, they are being completely ignored, and only the above rules are working.
For example, I have placed an .htaccess file in my public_html/admin directory, with the following rules
<IfModule litespeed>
php_value session.gc_maxlifetime 7200
php_flag display_errors On
</IfModule>
When checking phpinfo(); it shows that the values are still "200000" and "Off" instead of "7200" and "On" respectively.
Ok, after hours of debugging, it seems to be a Litespeed server bug:
To reproduce the issue:
add these lines to your .htaccess in the main dir (ie. http://website/)
<FilesMatch "\.(php)$">
deny from 207.14.19.21
</FilesMatch>
Then open up phpinfo in you sub-dir ((ie. http://website/subdir/). You will see that the sub-directory .htaccess can not override the PHP rules that were set in the .htaccess in the main dir.
By the way, the deny from 207.14.19.21 is just an example, you can put any rules you want instead, the issue is with the<FilesMatch "\.(php)$"> or any other FilesMatch that covers .php files (such as <FilesMatch "\.+$">)
You can even do:
<FilesMatch "\.(php)$">
order allow,deny
allow from all
</FilesMatch>
And it will cause the same issue.
P.S. This was originally discussed here:
https://www.litespeedtech.com/suppo...ng-ignored-in-sub-directory.13933/#post-93073