Multiple .htaccess files: which to keep, where to put?
-
[ Moderator note: moved to Fixing WordPress. ]
After reading these forums and a bunch of external pages, I’m uncertain – and very afraid of making a mistake that will open the site to hackers.
Background 1: I recently consolidated several independent sites (call them domain1.com, domain2.com etc.) as add-ons to one new shared-hosting domain (call it maindomain.com).
Background 2: Spambots and other nasties hit my site constantly. Recently, began having 508 error site closures due to too many entry processes, physical memory overuse and such. Host has killed “zombie processes” each time to restore service, but I have no idea what the faulty processes or attacks might be. NewStatPress and the cPanel Visitors log all show only about one-per-minute hits (some from bad bots), and not the thousands the host claims to see. So I don’t even know how to tell if I’m being attacked, or by what/whom.
Background 3: I routinely monitor NewStatPress for suspicious activity, and add bad IP addresses to All In One WP Security’s blacklist manager. When several close addresses show up, I used wildcards to blacklist whole ranges. Also use IQ Block to block the countries from which the worst offenders seem to come. Nonetheless, NSP and cPanel logs show steady hits from banned addresses. I’m *hoping* that that means they hit but were blocked.
There are currently several .htaccess files in various places in maindomain.com. Most of them are under 300 bytes. The big one (60 kB) with all the blacklist information is in a directory I’ll call public_html/domain2.com/blogname – in other words, the main WP install folder. Articles seem to indicate that a hit anywhere in the site will reach an .htaccess file wherever it may be.
So, the big questions:
– If there are smaller .htaccess files in home/maindomaincom, home/maindomaincom/public_html and several deeper places, will these just add their own directions/protections, or will they interfere with the one containing the blacklist?
– Should I delete all but the main one? If so, should I move it somewhere higher in the file structure so it covers all the sites? I have one other WP install in another add-on domain, call it domain3.com. If I put the big .htaccess file above where the domains are separate – say, in public_html or even the root home/maindomaincom – will it apply the same blacklists to all my sites? That would make life a lot easier!
Thanks so much for reading all this (if anyone does) and for whatever guidance you can offer.
- The topic ‘Multiple .htaccess files: which to keep, where to put?’ is closed to new replies.