Posted By

creativeboulder on 02/12/11


Tagged

compression htaccessgzipbad-botssite performancehtaccess rewritesite mobile-detection


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

NyX
creativeboulder
wirenaught
tomenjr


.htaccess (Standard with Compression and Bad-Bot ReWrites)


 / Published in: Apache
 

URL: http://forr.st/~DCW

UPDATE- Major Revision. Included this htaccess file into my repository called 'Server-side Boilerplate' to be used alongside the HTML5 Boilerplate. Located at https://github.com/codeclarity/Server-Side-Boilerplate

This is a basic .htaccess file for Apache. I have commented off certain sections for Gzip and File Type Compression, Basic Template for ReWrites and Web Font control, plus Cache-Control. Updated Includes Auto Encode to UTF-8 and Mobile Detection.

  1. # Complete .htaccess
  2. # @author Joshua Canfield (Code Clarity)
  3. # @url http://forr.st/~DCW
  4. # @license The PostgreSQL Licence (PostgreSQL)
  5. # Copyright (c) 2011-2012, Code Clarity (Joshua Canfield) <www.icodeclarity.com>
  6. #
  7. # Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is
  8. # hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
  9. #
  10. # IN NO EVENT SHALL CODE CLARITY (Joshua Canfield) BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
  11. # ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF $ORGANISATION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  12. #
  13. # CODE CLARITY (Joshua Canfield) SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  14. # FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND CODE CLARITY (Joshua Canfield) HAS NO OBLIGATIONS TO
  15. # PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  16.  
  17. # Thanks to Code-Kickoff (http://www.codekickoff.com/), yourdomain.org, @Zywigby (Charlie Key - http://forr.st/~IG8) and others.
  18. # (If you see your code snippets, please notify me.)
  19.  
  20. ## Basic Settings
  21. # (Allowing Execution of CGI Scripts, Following Symbolic Links and Not Allowing Public Viewing of Folders without an Index file)
  22. Options +execCGI +FollowSymLinks
  23. Options All -Indexes
  24.  
  25. ## Basic Error Documents
  26. # (Will add more soon. I typically have all error messages filter through a PHP file and use 404.php to display the error and direct the user)
  27. ErrorDocument 404 /404.php
  28. ErrorDocument 401 /404.php
  29. ErrorDocument 403 /404.php
  30. ErrorDocument 500 /404.php
  31.  
  32. ## Restrict Access to Domain/Folder by Order and Allow
  33. # (My current setup blocks known spammers that have DDoS Attacked me recently. Remove deny rules if needed)
  34. order allow,deny
  35. deny from 205.203.134.197
  36. deny from 109.230.246.24
  37. deny from 85.17.26.202
  38. deny from 85.17.26.196
  39. deny from 109.230.246.*
  40. allow from all
  41.  
  42. #3 Remove ETags (To learn more visit http://developer.yahoo.com/performance/rules.html#etags)
  43. Header unset ETag
  44. FileETag None
  45.  
  46. ## Use standardized UTF-8 for text/plain or text/html
  47. AddDefaultCharset utf-8
  48. ## Force UTF-8 Character Set for specific File Types
  49. AddCharset utf-8 .html .css .js .xml .json .rss
  50. DefaultLanguage en-US
  51.  
  52. ## htaccess for mod_php
  53. # SetEnv PHPRC /location/todir/containing/phpinifile
  54.  
  55. ## htaccess for PHP as CGI
  56. # AddHandler php-cgi .php .htm
  57. # Action php-cgi /cgi-bin/php5.cgi
  58.  
  59. ## Disallow Script Execution
  60. # Options -ExecCGI
  61. # AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
  62.  
  63. ## Redirect Mobile Browser Accessing /siteurltoredirect
  64. # RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
  65. # RewriteRule ^yourdomain.com$ http://mobile.yourdomain.com [R,L]
  66.  
  67. ## Gzip and Compression
  68. # (Ref1) Add custom mime type, to be able to use it in the 'AddOutputFilterByType' declaration (gzip font-face files: http://www.phpied.com/gzip-your-font-face-files/)
  69. # (Ref2) Proper svg serving. Required for svg webfonts on iPad (http://twitter.com/FontSquirrel/status/14855840545)
  70. # (Ref3) Apache 1.3 uses mod_gzip while Apache 2.x uses mod_deflate (http://httpd.apache.org/docs/2.0/mod/mod_deflate.html)
  71. # (Ref4) Enable the compression (gzip) for any type of content SetOutputFilter DEFLATE Or (alternatively) define which filetypes should pass through the DEFLATE output filter (gzip compression)
  72. # (Ref5) Turn-off (or restrict) compression to files of type text/html for known problematic web browsers
  73. # (Ref6) File types not to be compressed
  74. # (Ref7) Make sure proxies don't deliver the wrong content
  75. # (Ref8) Allow access from all domains for webfonts (alternatively you could only whitelist your subdomains like "sub.domain.com")
  76. <IfModule mod_headers.c>
  77. <IfModule mod_mime.c> #Ref1
  78. AddType application/vnd.ms-fontobject .eot
  79. AddType font/truetype .ttf
  80. AddType font/opentype .otf
  81. AddType font/woff .woff
  82. AddType image/svg+xml svg svgz #Ref2
  83. AddEncoding gzip svgz
  84. </IfModule>
  85. <IfModule mod_deflate.c> #Ref3
  86. AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript application/json #Ref4
  87. <FilesMatch "\.(ttf|otf|woff|eot|svg|svgz)$" >
  88. SetOutputFilter DEFLATE
  89. </FilesMatch>
  90. BrowserMatch ^Mozilla/4 gzip-only-text/html #Ref5
  91. BrowserMatch ^Mozilla/4\.0[678] no-gzip
  92. ## BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  93. # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 the above regex won't work. You can use the following workaround to get the desired effect:
  94. BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  95.  
  96. SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary #Ref6
  97. SetEnvIfNoCase Request_URI \.(?:swf|flv|pdf)$ no-gzip dont-vary
  98. SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
  99. SetEnvIfNoCase Request_URI \.(?:avi|mov)$ no-gzip dont-vary
  100. SetEnvIfNoCase Request_URI \.(?:mp3|mp4)$ no-gzip dont-vary
  101.  
  102. Header append Vary User-Agent env=!dont-vary #Ref7
  103.  
  104. </IfModule>
  105. <FilesMatch "\.(ttf|otf|eot|woff|font.css)$"> #Ref8
  106. Header set Access-Control-Allow-Origin "*"
  107. </FilesMatch>
  108. </IfModule>
  109.  
  110. ## Setup Custom Headers
  111. # Header set P3P "policyref=\"http://www.yourdomain.com/w3c/p3p.xml\""
  112. # Header set X-Pingback "http://www.yourdomain.com/xmlrpc.php"
  113. # Header set Content-Language "en-US"
  114. # Header set Vary "Accept-Encoding"
  115.  
  116. ## Force the latest IE version, in various cases when it may fall back to IE7 mode. (http://github.com/rails/rails/commit/123eb25#commitcomment-118920)
  117. # Use ChromeFrame if it's installed for a better experience for the poor IE folk
  118. <IfModule mod_setenvif.c>
  119. <IfModule mod_headers.c>
  120. BrowserMatch MSIE ie
  121. Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
  122. </IfModule>
  123. </IfModule>
  124.  
  125. ## Add values from HTTP Headers
  126. # SetEnvIfNoCase ^If-Modified-Since$ "(.+)" HTTP_IF_MODIFIED_SINCE=$1
  127. # SetEnvIfNoCase ^If-None-Match$ "(.+)" HTTP_IF_NONE_MATCH=$1
  128. # SetEnvIfNoCase ^Cache-Control$ "(.+)" HTTP_CACHE_CONTROL=$1
  129. # SetEnvIfNoCase ^Connection$ "(.+)" HTTP_CONNECTION=$1
  130. # SetEnvIfNoCase ^Keep-Alive$ "(.+)" HTTP_KEEP_ALIVE=$1
  131. # SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
  132. # SetEnvIfNoCase ^Cookie$ "(.+)" HTTP_MY_COOKIE=$1
  133.  
  134. ## Allow combination of Javascript and CSS Stylesheets
  135. # ie. Inside of script.combined.js you could have
  136. # <!--#include file="jquery-1.4.2.js" -->
  137. # <!--#include file="jquery.idletimer.js" -->
  138. # and they would be included into this single file this is not in use in the boilerplate as it stands. you may choose to name your files in this way for this advantage or concatenate and minify them manually.
  139. # Disabled by default.
  140. #
  141. # <FilesMatch "\.combined\.(js|css)$">
  142. # Options +Includes
  143. # SetOutputFilter INCLUDES
  144. # </FilesMatch>
  145.  
  146. ## Setup Cache-Control and Expires by File Types
  147. <IfModule mod_expires.c>
  148. <FilesMatch "\.(gif|jpg|jpeg|png|swf|flv|pdf|ico|avi|mov|ppt|doc|mp3|wmv|wav|txt|css|js|html?|php|xml|eot|ttf|otf|woff)$">
  149. ExpiresActive On
  150. Header unset Last-Modified
  151. Header set Expires "Fri, 21 Dec 2013 00:00:00 GMT"
  152. Header set Cache-Control "public, no-transform"
  153. ExpiresDefault "access plus 1 year"
  154. FileETag Size
  155. </FilesMatch>
  156. <FilesMatch "\.(gif|jpg|jpeg|png|swf|flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|txt|eot|ttf|otf|woff)$">
  157. Header append Cache-Control: public
  158. </FilesMatch>
  159. <FilesMatch "\.(css|js|html?|php|xml)$">
  160. Header append Cache-Control: private
  161. </FilesMatch>
  162. </IfModule>
  163.  
  164. ## Caching by Content Type using mod_expires.c
  165. <IfModule mod_expires.c>
  166. ExpiresActive On
  167. ExpiresDefault A86400
  168. ExpiresByType image/x-icon A2592000
  169. ExpiresByType application/x-javascript A2592000
  170. ExpiresByType text/css A2592000
  171. ExpiresByType image/gif A604800
  172. ExpiresByType image/png A604800
  173. ExpiresByType image/jpeg A604800
  174. ExpiresByType text/plain A604800
  175. ExpiresByType application/x-shockwave-flash A604800
  176. ExpiresByType video/x-flv A604800
  177. ExpiresByType application/pdf A604800
  178. ExpiresByType text/html A900
  179. </IfModule>
  180.  
  181. ## Cache-Control by File Type
  182. <FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
  183. Header set Cache-Control "max-age=7257600" # 3 Months
  184. </FilesMatch>
  185. <FilesMatch "\.(js|css|pdf|txt)$">
  186. Header set Cache-Control "max-age=604800" # 1 Week
  187. </FilesMatch>
  188. <FilesMatch "\.(html|htm)$">
  189. Header set Cache-Control "max-age=600" # 10 Minutes
  190. </FilesMatch>
  191. <FilesMatch "\.(pl|php|cgi|spl)$">
  192. Header unset Cache-Control
  193. Header unset Expires
  194. Header unset Last-Modified
  195. FileETag None
  196. Header unset Pragma # No Caching
  197. </FilesMatch>
  198.  
  199. ## Redirect old links or pages using 301
  200. # <IfModule mod_rewrite.c>
  201. # RewriteEngine On
  202. # RewriteBase /
  203. # RewriteRule ^somedirectory/(.*)$ http://yourdomain.com/page.php [L,R=301] # Redirect Directory to Specific Page
  204. # RewriteRule ^page.html$ http://www.yourdomain.com/newpage.php [L,R=301] # Redirect Specific Page to Specific Page
  205. # </IfModule>
  206.  
  207. ## Alternative Redirection
  208. # Redirect 301 / http://www.yourdomain.com
  209. # RedirectMatch 301 /blog(.*) /$1
  210. # RedirectMatch 302 ^/ /temporary-offline.html
  211. RedirectMatch 301 ^/(.*)$ http://www.yourdomain.com/$1
  212.  
  213.  
  214. ## Protect your php.ini
  215. # (http://www.askapache.com/htaccess/htaccess.html#mod_rewrite-examples)
  216. # <FilesMatch "^php5?\.(ini|cgi)$">
  217. # Order Deny,Allow
  218. # Deny from All
  219. # Allow from env=REDIRECT_STATUS
  220. # </FilesMatch>
  221.  
  222. ## Deny Request Methods
  223. # (http://www.askapache.com/htaccess/htaccess.html#mod_rewrite-examples)
  224. # RewriteCond %{REQUEST_METHOD} !^(GET|HEAD|OPTIONS|POST|PUT)
  225. # RewriteRule .* - [F]
  226.  
  227. ## Refuse Hotlinking of Files and Images
  228. # RewriteCond %{HTTP_REFERER} !^$
  229. # RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
  230. # RewriteRule \.(gif|jpg|swf|flv|png)$ http://www.yourdomain.com/feed.gif [R=302,L]
  231.  
  232. ## Alternative Hotlinking Fix
  233. # RewriteCond %{HTTP_REFERER} !^$
  234. # RewriteCond %{REQUEST_URI} !^/(wp-login.php|wp-admin/|wp-content/plugins/|wp-includes/).* [NC]
  235. # RewriteCond %{HTTP_REFERER} !^http://www.askapache.com.*$ [NC]
  236. # RewriteRule \.(ico|pdf|flv|jpg|jpeg|mp3|mpg|mp4|mov|wav|wmv|png|gif|swf|css|js)$ - [F,NS,L]
  237.  
  238. ## Redirect Bad Bots and Spammers
  239. <IfModule mod_rewrite.c>
  240. RewriteEngine On
  241. RewriteBase /
  242. RewriteCond %{HTTP_USER_AGENT} ^(aesop_com_spiderman|alexibot|backweb|bandit|batchftp|bigfoot) [NC,OR]
  243. RewriteCond %{HTTP_USER_AGENT} ^(black.?hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye) [NC,OR]
  244. RewriteCond %{HTTP_USER_AGENT} ^(cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck) [NC,OR]
  245. RewriteCond %{HTTP_USER_AGENT} ^(cosmos|crescent|curl|custo|da|diibot|disco|dittospyder|dragonfly) [NC,OR]
  246. RewriteCond %{HTTP_USER_AGENT} ^(drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon) [NC,OR]
  247. RewriteCond %{HTTP_USER_AGENT} ^(emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky) [NC,OR]
  248. RewriteCond %{HTTP_USER_AGENT} ^(frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet) [NC,OR]
  249. RewriteCond %{HTTP_USER_AGENT} ^(grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot) [NC,OR]
  250. RewriteCond %{HTTP_USER_AGENT} ^(infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar) [NC,OR]
  251. RewriteCond %{HTTP_USER_AGENT} ^(joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb) [NC,OR]
  252. RewriteCond %{HTTP_USER_AGENT} ^(likse|linkscan|linkwalker|lnspiderguy|lwp|magnet|mag-net|markwatch) [NC,OR]
  253. RewriteCond %{HTTP_USER_AGENT} ^(mata.?hari|memo|microsoft.?url|midown.?tool|miixpc|mirror|missigua) [NC,OR]
  254. RewriteCond %{HTTP_USER_AGENT} ^(mister.?pix|moget|mozilla.?newt|nameprotect|navroad|backdoorbot|nearsite) [NC,OR]
  255. RewriteCond %{HTTP_USER_AGENT} ^(net.?vampire|netants|netcraft|netmechanic|netspider|nextgensearchbot) [NC,OR]
  256. RewriteCond %{HTTP_USER_AGENT} ^(attach|nicerspro|nimblecrawler|npbot|octopus|offline.?explorer) [NC,OR]
  257. RewriteCond %{HTTP_USER_AGENT} ^(offline.?navigator|openfind|outfoxbot|pagegrabber|papa|pavuk) [NC,OR]
  258. RewriteCond %{HTTP_USER_AGENT} ^(pcbrowser|php.?version.?tracker|pockey|propowerbot|prowebwalker) [NC,OR]
  259. RewriteCond %{HTTP_USER_AGENT} ^(psbot|pump|queryn|recorder|realdownload|reaper|reget|true_robot) [NC,OR]
  260. RewriteCond %{HTTP_USER_AGENT} ^(repomonkey|rma|internetseer|sitesnagger|siphon|slysearch|smartdownload) [NC,OR]
  261. RewriteCond %{HTTP_USER_AGENT} ^(snake|snapbot|snoopy|sogou|spacebison|spankbot|spanner|sqworm|superbot) [NC,OR]
  262. RewriteCond %{HTTP_USER_AGENT} ^(superhttp|surfbot|asterias|suzuran|szukacz|takeout|teleport) [NC,OR]
  263. RewriteCond %{HTTP_USER_AGENT} ^(telesoft|the.?intraformant|thenomad|tighttwatbot|titan|urldispatcher) [NC,OR]
  264. RewriteCond %{HTTP_USER_AGENT} ^(turingos|turnitinbot|urly.?warning|vacuum|vci|voideye|whacker) [NC,OR]
  265. RewriteCond %{HTTP_USER_AGENT} ^(libwww-perl|widow|wisenutbot|wwwoffle|xaldon|xenu|zeus|zyborg|anonymouse) [NC,OR]
  266. RewriteCond %{HTTP_USER_AGENT} ^web(zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|reaper|sauger|site.?quester|whack) [NC,OR]
  267. RewriteCond %{HTTP_USER_AGENT} ^.*(craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|collector|grabber|webpictures).*$ [NC]
  268. RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
  269. RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:[email protected] [OR]
  270. RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
  271. RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
  272. RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
  273. RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
  274. RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
  275. RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]
  276. RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
  277. RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
  278. RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]
  279. RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
  280. RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]
  281. RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]
  282. RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]
  283. RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]
  284. RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]
  285. RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]
  286. RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]
  287. RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]
  288. RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]
  289. RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]
  290. RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]
  291. RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]
  292. RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]
  293. RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]
  294. RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]
  295. RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]
  296. RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]
  297. RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]
  298. RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]
  299. RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]
  300. RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]
  301. RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]
  302. RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]
  303. RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]
  304. RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]
  305. RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]
  306. RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]
  307. RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]
  308. RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]
  309. RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]
  310. RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]
  311. RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]
  312. RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]
  313. RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]
  314. RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]
  315. RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]
  316. RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]
  317. RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]
  318. RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]
  319. RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]
  320. RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]
  321. RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]
  322. RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]
  323. RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]
  324. RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]
  325. RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]
  326. RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]
  327. RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]
  328. RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]
  329. RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]
  330. RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]
  331. RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]
  332. RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]
  333. RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]
  334. RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]
  335. RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]
  336. RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]
  337. RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]
  338. RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]
  339. RewriteCond %{HTTP_USER_AGENT} ^Wget [OR]
  340. RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]
  341. RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]
  342. RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
  343. RewriteCond %{HTTP_USER_AGENT} ^Zeus
  344. </IfModule>
  345.  
  346. ## Block Common Exploits
  347. # *Caution* These fixes can break plugins and modules. Use with caution please.
  348. # RewriteCond %{REQUEST_URI} !^/(wp-login.php|wp-admin/|wp-content/plugins/|wp-includes/).* [NC]
  349. # RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ ///.*\ HTTP/ [NC,OR]
  350. # RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\?\=?(http|ftp|ssl|https):/.*\ HTTP/ [NC,OR]
  351. # RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\?\?.*\ HTTP/ [NC,OR]
  352. # RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.(asp|ini|dll).*\ HTTP/ [NC,OR]
  353. # RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.(htpasswd|htaccess|aahtpasswd).*\ HTTP/ [NC]
  354. # RewriteRule .* - [F,NS,L]
  355.  
  356. ## Forbid Proxy Servers
  357. # RewriteCond %{REQUEST_METHOD} =POST
  358. # RewriteCond %{HTTP:VIA}%{HTTP:FORWARDED}%{HTTP:USERAGENT_VIA}%{HTTP:X_FORWARDED_FOR}%{HTTP:PROXY_CONNECTION} !^$ [OR]
  359. # RewriteCond %{HTTP:XPROXY_CONNECTION}%{HTTP:HTTP_PC_REMOTE_ADDR}%{HTTP:HTTP_CLIENT_IP} !^$
  360. # RewriteCond %{REQUEST_URI} !^/(wp-login.php|wp-admin/|wp-content/plugins/|wp-includes/).* [NC]
  361. # RewriteRule .* - [F,NS,L]

Report this snippet  

You need to login to post a comment.