0

I have an .htaccess file 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 file 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.

Why does this happen and how can I fix it?

Nikita 웃
  • 101
  • 5

2 Answers2

1

Be sure to allow override where you want it.

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

AllowOverride None will disable .htaccess.

jarvis
  • 1,956
  • 4
  • 17
  • 31
  • That's odd. I have AllowOverride All , doesn't it suppose to also cover all the tree under it? ie /home/user/public_html/admin/ – Nikita 웃 Apr 26 '16 at 09:49
0

Turns out litespeed server had a bug that I discovered. I have reported it to LS and they consequently fixed it:

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

Nikita 웃
  • 101
  • 5