Forum Moderators: phranque
(Q) My question is, is it better to have few RewriteRules or have one every few lines of blockage, say one rule for each of the following or combine 2 or 3 under one RewriteRule, or does it make a big difference either way?
I am working on another area also, trying to set blocks for bots that are not from a certain IP range - I keep 403ing BingBot,MsnBot, Google, Slurp,Yandex.. I have the IP ranges correct except maybe the 157.*.*.* of Bing/Msn - I have now placed those ranges at the end of my Mod_Rewrite Module and at the moment haven't had a Bot hit to verify they are making it through - before I had them place at the top of my Module before the denying of IP's, etc
My understanding is at every rewrite rule the processing will stop to make a check- so my thought is, perhaps fewer stops may be better - but again if at a check at a rewrite rule there may be too many conditions to go back and check before proceding to the next rule.
At the moment I am trying to get my htaccess file running as smooth as I can. My understanding is at every rewrite rule the processing will stop to make a check- so my thought is, perhaps fewer stops may be better - but again if at a check at a rewrite rule there may be too many conditions to go back and check before proceding to the next rule.
Add a blank line after every RewriteRule to make the code easier to read. Add a comment before each ruleset explaining what it does.
There are numerous examples of this going back some years in the SSID forum.
try a search on fake+google
For a couple of years I used mod_setenvif, and all went well, then a server upgrade from 1.3 to 2.? Apache came along and mod_setenvif no longer worked.
If your using a shared host, in which SetEnvIf does not function?
Locate a NEW host immediately.
<IfModule mod_deflate.c>
at one point I was able to, in part, use mod_security, but that was nixed along with mod_setenvif
Redirect /foobar.html /widget.html
RewriteRule foobar something-other-than-widget.html [R]
SetEnvIf Request_URI foobar keep_out One or more of the others will be along later to provide and explanation of NOT using module containers in htaccess, especially on shared hosting.