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

Discussion in 'General' started by dgtl, Jun 1, 2014.

  1. dgtl

    dgtl New Member

    I'm seeing a lot of warning about the size of an .htaccess file:

    [/<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?
  2. NiteWave

    NiteWave Administrator

    does /<path>/.htaccess exist ? if exist,
    #ls -l /<path>/.htaccess
  3. dgtl

    dgtl New Member

    Hey NiteWave,

    Yes, it sure does exist.


    -rw-r--r-- 1 <user> <user> 200113 Apr 4 11:03 /path/to/user/public_html/subdir/.htaccess
  4. NiteWave

    NiteWave Administrator

    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 ?
    #wc -l /path/to/user/public_html/subdir/.htaccess
  5. dgtl

    dgtl New Member

    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?
  6. NiteWave

    NiteWave Administrator

    can you give an sample of this 250K .htaccess file ? e.g., we can download it via a link ?
  7. dgtl

    dgtl New Member

    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.
  8. NiteWave

    NiteWave Administrator

    Sorry ... the .htaccess is around 200K not 250K.
    -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.
  9. dgtl

    dgtl New Member

    Hi NiteWave,

    Can I privately send it to you instead of publicly posting it in the form?
  10. NiteWave

    NiteWave Administrator

    ok and thanks.

    you can start a conversation with me, and upload file there.
    or provide a link to that file
    or send email to bug@...
  11. dgtl

    dgtl New Member

    Hi NiteWave,

    Done. I sent you the link in a conversation.
  12. mistwang

    mistwang LiteSpeed Staff

    We raise the limit to 250K in 4.2.12, you can give it a try
    /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.
  13. dgtl

    dgtl New Member

    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!
  14. ffeingol

    ffeingol Member

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

    NiteWave Administrator

    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.

    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:
    bad_ip_1 1
    bad_ip_2 1
    ....
    bad_ip_3 1

    so instead of updating .htaccess, update /path/to/file/badip.txt
  16. ffeingol

    ffeingol Member

    I'll have the client give that a try.

Share This Page