[Resolved] WARN file size is over 100K, could be a bad .htaccess

Status
Not open for further replies.
#1
I'm seeing a lot of warning about the size of an .htaccess file:
Code:
[/<path>/.htaccess] file size is over 100K, could be a bad .htaccess
I couldn't find out what triggers this warning. This is LSWS Latest on CloudLinux 6.5 w/ cPanel.

Thoughts?
 
Last edited by a moderator:
#3
Hey NiteWave,

Yes, it sure does exist.
Code:
-rw-r--r-- 1 <user> <user> 200113 Apr  4 11:03 /path/to/user/public_html/subdir/.htaccess
 
Last edited by a moderator:

NiteWave

Administrator
#4
the file size is nearly 200K, too big, please edit it to see if too many unnecessary repeated lines in it.
how many lines of the file ?
Code:
#wc -l /path/to/user/public_html/subdir/.htaccess
 
Last edited by a moderator:
#5
Hi NiteWave,

There are no repeated lines, and yes... The file is rather large for an .htaccess file (iThemes Security rules for WordPress). I'd like to know where I can change the limit warn to trigger at a larger size, like maybe 250K?
 
#7
Hi NiteWave,

There's no .htaccess file that is 250k. I was just curious if I can up the warn trigger so it warns when a file is larger than 250k, that's all. In other words, I want to suppress the warning for .htaccess files smaller than 250K instead of having it warn for 100K.
 

NiteWave

Administrator
#8
Sorry ... the .htaccess is around 200K not 250K.
Code:
-rw-r--r-- 1 <user> <user> 200113 Apr 4 11:03 /path/to/user/public_html/subdir/.htaccess
I think no such option(100K or 250K etc) at current version.
this is a limit in recent version .... one or 2 users has very large .htaccess file( some lines duplicated many times) and it has caused 100% CPU of litespeed process. so developer has added this limit to avoid this 100% CPU issue. it looks like 100K is big enough but from this case you reported, it has blocked a normal .htaccess ... let's work out a more reasonable solution after investigating this exception. I'll leave our developer to answer this thread. I think if we can get a copy of this .htaccess and read it, it'll give us an idea how big a normal .htaccess can be and the better solution for this issue.
 
Last edited by a moderator:

mistwang

LiteSpeed Staff
#12
We raise the limit to 250K in 4.2.12, you can give it a try
Code:
/usr/local/lsws/admin/misc/lsup.sh -f -v 4.2.12
However, we recommend avoiding large htaccess when possible. It may cause performance problem.
 
Last edited by a moderator:
#13
Hi Mistwang,

Thanks a lot! You guys are awesome :)

And absolutely, a large .htaccess file is always a bad, bad idea! But this will help keep the error log a little bit smaller while I deal with the customer who's htaccess file is too large!
 

ffeingol

Well-Known Member
#14
Hell,

We're running into a similar issue. The .htaccess file is 2.3 MB and it's about 90K lines log. Not getting the warning messages, but most of the pages on the site come up with 404 / not found. If you trim down the .htaccess it works fine.

There are no duplicate lines. It's almost all deny ##.##.##.##/## as it's an e-commerce site and they are trying to block non-us orders.
 
#15
recommend to use rewritemap:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritemap
to greatly reduce the .htaccess size and speed up the process.
Code:
RewriteMap BADIPLIST txt:/path/to/file/badip.txt

RewriteCond ${BADIPLIST:%{REMOTE_ADDR}|0} =1
RewriteRule . - [F,L]
the format of /path/to/file/badip.txt:
Code:
bad_ip_1 1
bad_ip_2 1
....
bad_ip_3 1
so instead of updating .htaccess, update /path/to/file/badip.txt
 
Last edited by a moderator:
Status
Not open for further replies.
Top