• Twice now on two separate instances of WordPress (both current installs, both on Dreamhost) the htaccess file has grown too large and then, for some reason, is truncated, which causes the file to be incomplete, which in turn causes a 500 internal server error.

    The solution is easy — replace htaccess with a known good one — but I want it not to happen again.

    What happens is that the plugin just keeps writing to htaccess and never culls the addresses that it is blocking there. In the server that just had the problem, that behavior resulted in a large htaccess file — more than 18,000 lines and 728K in file size.

    What htaccess could have is some sort of trimming option. Perhaps “remove unseen bad hosts older than X days” or “limit bad host list to X number of entries.”

Viewing 5 replies - 1 through 5 (of 5 total)
  • We are experiencing the exact issue. Can we get a Trim option, as GrantBarrett suggested? This would make sense, so not to bloat the htaccess file to something that is 700k in size.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    more than 18,000 lines and 728K in file size.

    Wow. That is … Okay that’s huge. And let me be blunt here: a large .htaccess file will make your site slow.

    Read https://stackoverflow.com/a/4435531

    That’s why server admins use stuff like Fail2Ban and IPTables to dynamically catch and block bad actors on the server side. It’s faster and it does exactly what you say you’d like. If you’re on DreamHost, I recommend using our Extra Web Security, as that actually will do just that and block IPs more dynamically.

    In so far as plugins, I would really want to see this handled by PHP and everything stored in a DB table so it could be purged more dynamically, but even so, the larger your block list, the slower your site ?? That’s, again, why servers only block people doing bad things, and not flagrantly.

    Thread Starter grantbarrett

    (@grantbarrett)

    a large .htaccess file will make your site slow.

    Yes, of course.

    I will look into the Extra Web Security. Thanks!

    Thread Starter grantbarrett

    (@grantbarrett)

    PS: Extra Web Security was already enabled for both domains.

    I am having the exact same problem. Site went down with 500 Internal Server Error due to a truncated entry from iThemes in the .htaccess file (last line just says “Require not i” instead of “Require not ip 000.00.000.00”. iThemes has made our .htaccess file over 400kb in size. Renaming the file and replacing with a blank .htaccess fixed the 500 error, but I share the frustration of the OP about iThemes not having any feature to cull the IPs in .htaccess and prevent the site from crashing like this.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘htaccess gets truncated then causes internal server error’ is closed to new replies.