FilesMatch & php .htaccess options

priestjim

Well-Known Member
#1
Hi!

We are experiencing an issue with the FilesMatch directive and the php_* htaccess options.

A client of ours is using BBClone to monitor his stats but after we switched to LS, the statistics parsing method stopped working. I've pinpointed the error to the .htaccess file he uses:

Code:
AddType application/x-httpd-php4 htm html
<FilesMatch "index.htm">
 php_value auto_append_file "/var/www/vhosts/xxx/httpdocs/count.php"
</FilesMatch>
If I remove the FilesMatch directive, everything works fine, but with it on, the count.php file does not get appended!

Any help would be appreciated.
 

priestjim

Well-Known Member
#3
Is it generally working now with directives like "FilesMatch", "Files" and "DirectoryMatch" and options php_flag, php_value, php_admin_flag, php_admin_value, or just FilesMatch and php_value?

Anyway, thanks for the quick response and fix!
 

DraCoola

Well-Known Member
#4
Thank you for thread starter.
I am also have a question regarding to .htaccess

Cpanel always create rewrite rules just like this :
-----------------------------------------------
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^.?$ "http\:\/\/domain\.com\/folder" [R=302,L]
-----------------------------------------------

That default Cpanel rules are often (always) makes browser bring Redirect loop error reports with LSWS.




So I have to always manually edit/simply modify that rules to :
-----------------------------------------------
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ "http\:\/\/domain\.com\/folder" [R=302,L]
-----------------------------------------------

That will work fine with LSWS.

So the question is :
How to make LSWS automatically work with default Cpanel redirect rules?
Because it is so wasting time to manualy edit so many .htaccess, which suppose to be just worked at a time after created from Cpanel.

Thank you.
 

mistwang

LiteSpeed Staff
#5
How do you make cPanel create rule like that?

The default rule does not look right, as it redirects request with "domain.com" to http://domain.com/, so it causes loop redirections.
I don't know why Apache does not cause loop redirection with it.
We need to investigate.
 

DraCoola

Well-Known Member
#6
I don't know how, but Cpanel is always create rules just like that when creating redirect from Cpanel's redirect menu.

The situation is the same way either with old or new hosting account.
Redirect domain/subdomain/folder to another url will causing redirect loop.

So everytime after setuping redirect from Cpanel's menu, I have to replace "." with "/" by my self.

Any clue?
Or I have to PM my temporary root detail to you so you could investigate this?
 

DraCoola

Well-Known Member
#7
Ramdomly redirect loop victim --> http://audiogazmo.com

Even mysql.allow persistent turned Off on php ini.

The .htaccess :
-----------------------------------------------
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
-----------------------------------------------


The error log from Cpanel :
-----------------------------------------------
2009-05-28 08:58:44.888 [INFO] [HTAccess] Updating configuration from [/home1/audiocom/public_html/.htaccess]
2009-05-28 08:52:28.582 [INFO] [HTAccess] Updating configuration from [/home1/audiocom/public_html/.htaccess]
2009-05-28 08:50:40.281 [INFO] [HTAccess] Updating configuration from [/home1/audiocom/public_html/.htaccess]
-----------------------------------------------


Everyday, twice or more, any of my customers report that their websites cannot open because of Redirect Loop.
I'm so tired with this many ways of Redirect Loop problems...
 
Last edited:

Tony

Well-Known Member
#8
With wordpress the cause is far more likely in wordpress they have it set to www.audiogazmo.com and the htaccess to audiogazmo.com then you create a loop.

Maybe not in this case but a lot of the time thats the issue with wordpress.
 

DraCoola

Well-Known Member
#15
The newest victim, reported just few minutes ago ---> http://mp3smackers.com

And here is the whole .htaccess entry :
---------------------------------------------
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
---------------------------------------------

I didn't change anything to fix that. Just confuse, give up, and waiting for your solution


The only simple fix I did is just for the default redirect rule from Cpanel.
---> http://www.litespeedtech.com/support/forum/showpost.php?p=15371&postcount=4
 

mistwang

LiteSpeed Staff
#18
The newest victim, reported just few minutes ago ---> http://mp3smackers.com

And here is the whole .htaccess entry :
---------------------------------------------
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
---------------------------------------------

I didn't change anything to fix that. Just confuse, give up, and waiting for your solution


The only simple fix I did is just for the default redirect rule from Cpanel.
---> http://www.litespeedtech.com/support/forum/showpost.php?p=15371&postcount=4
It does not make much sense with the information you provided, if that's the whole .htaccess file, how could you fix the redirect rule causing problem if those rules does not even in the .htaccess? :confused:

I need the exact and complete .htaccess file that causing loop redirections.
 

DraCoola

Well-Known Member
#20
It does not make much sense with the information you provided, if that's the whole .htaccess file, how could you fix the redirect rule causing problem if those rules does not even in the .htaccess? :confused:

I need the exact and complete .htaccess file that causing loop redirections.
I thought, if from wordpress case, it doesn't caused by .httaccess.
As my screen shoots for LSWS and Apache at above, there is "301 moved permanently" that have been makes page redirected in loop.

I'm Also not doing fixing for anything for that wordpress cases.
Because I have just replacing each other between apache and LSWS, and then it magically fixed.
But actually... that's not the permanent fixed.
Because if it accessed from command line : "HEAD mp3smackers.com", there are still shows for redirect loop.

So I guest the "finally fixed shown on browser" cames from cache after using Apache temporarily before it went back to LSWS?
 
Top