Override All WordPress htaccess on server

Solution:

I assume that you have read up on the RewriteOptions directive. As I explain in Tips for debugging .htaccess rewrite rules and as you have found with WP which generates its own .htaccess files, by default the current path is scanned for .htaccess and the rewrite rules in the lowest are applied unless a higher one specifies a RewriteOptions Inherit in which case it’s rules are executed after rules specified in the child scope, and this is the catch-22 in that WP access file generates a [L] flag on all its execution paths preventing the parent rules from firing.

So the answer is to do this with an Apache mechanism other than rewrite and you can use the SetEnvIf directive:

SetEnvIf Remote_Addr "!^192\.168\." forbidden
<Files *>
  Order allow,deny
  Allow from all
  Deny from env=forbidden
</Files> 

or

SetEnvIf Remote_Addr "!^192\.168\." forbidden
<Directory /var/www/wproot>
  Order allow,deny
  Allow from all
  Deny from env=forbidden
</Directory> 

Clearly you’ll need to change the Regexp to your local needs but this should do the biz. The Apache docs give other variants on this, but you should be able to find one which works in your case. Just put this in the a per-virtual server context — within a Directory(Match) directive if necessary — or in a common parent directory .htaccess file.