.htaccess php_value和php_flag在子目录中被忽略

我有一个.htaccess文件在我的public_html目录下面的规则:

<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> 

他们工作正常,通过phpinfo();确认phpinfo();

但是,当我将.htaccess文件放在一个子目录中时,假定要覆盖上面的规则,它们被完全忽略,只有上述规则正在工作。

例如,我已经在我的public_html / admin目录中放置了一个.htaccess文件,并遵循以下规则

 <IfModule litespeed> php_value session.gc_maxlifetime 7200 php_flag display_errors On </IfModule> 

在检查phpinfo(); 它显示值分别仍然是“200000”和“关”而不是“7200”和“开”。

为什么会发生这种情况,我该如何解决?

一定要允许覆盖你想要的地方。

 <Directory "/var/www/htdocs"> AllowOverride All </Directory> 

AllowOverride None将禁用.htaccess。

原来litespeed服务器有一个我发现的bug。 我已经把它报告给LS,并且因此修正了它:

https://www.litespeedtech.com/support/forum/threads/solved-htaccess-php_value-and-php_flag-being-ignored-in-sub-directory.13933/