Guest User

Untitled

a guest
Jul 17th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <IfModule mod_security.c>
  2. SecFilterEngine Off
  3. SecFilterScanPOST Off
  4. </IfModule>
  5.  
  6. <IfModule mod_security.c>
  7. <Files async-upload.php>
  8. SecFilterEngine Off
  9. SecFilterScanPOST Off
  10. </Files>
  11. </IfModule>
  12.  
  13. # ----------------------------------------------------------------------
  14. # Better website experience for IE users
  15. # ----------------------------------------------------------------------
  16.  
  17. # Force the latest IE version, in various cases when it may fall back to IE7 mode
  18. # github.com/rails/rails/commit/123eb25#commitcomment-118920
  19. # Use ChromeFrame if it's installed for a better experience for the poor IE folk
  20.  
  21. <IfModule mod_headers.c>
  22. Header set X-UA-Compatible "IE=Edge,chrome=1"
  23. # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
  24. <FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webm|webp|woff|xml|xpi)$">
  25. Header unset X-UA-Compatible
  26. </FilesMatch>
  27. </IfModule>
  28.  
  29. # ----------------------------------------------------------------------
  30. # CORS-enabled images (@crossorigin)
  31. # ----------------------------------------------------------------------
  32.  
  33. # Send CORS headers if browsers request them; enabled by default for images.
  34. # developer.mozilla.org/en/CORS_Enabled_Image
  35. # blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
  36. # hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
  37. # wiki.mozilla.org/Security/Reviews/crossoriginAttribute
  38.  
  39. <IfModule mod_setenvif.c>
  40. <IfModule mod_headers.c>
  41. # mod_headers, y u no match by Content-Type?!
  42. <FilesMatch "\.(gif|ico|jpe?g|png|svg|svgz|webp)$">
  43. SetEnvIf Origin ":" IS_CORS
  44. Header set Access-Control-Allow-Origin "*" env=IS_CORS
  45. </FilesMatch>
  46. </IfModule>
  47. </IfModule>
  48.  
  49.  
  50. # ----------------------------------------------------------------------
  51. # Webfont access
  52. # ----------------------------------------------------------------------
  53.  
  54. # Allow access from all domains for webfonts.
  55. # Alternatively you could only whitelist your
  56. # subdomains like "subdomain.example.com".
  57.  
  58. <IfModule mod_headers.c>
  59. <FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">
  60. Header set Access-Control-Allow-Origin "*"
  61. </FilesMatch>
  62. </IfModule>
  63.  
  64. #disable the server signature
  65. ServerSignature Off
  66.  
  67. #Prevent folder browsing
  68. Options All -Indexes
  69.  
  70. #Remove PHP Version
  71. <ifModule mod_headers.c>
  72. Header unset X-Powered-By
  73. Header unset Server
  74. </IfModule>
  75.  
  76. #PROTECT wp-config.php
  77. <files wp-config.php>
  78. Order deny,allow
  79. deny from all
  80. </files>
  81.  
  82. #PROTECT readme.html
  83. <files readme.html>
  84. Order deny,allow
  85. deny from all
  86. </files>
  87.  
  88. #PROTECT wp-config-sample.php
  89. <files wp-config-sample.php>
  90. Order Allow,Deny
  91. Deny from all
  92. Satisfy all
  93. </files>
  94.  
  95. #PROTECT install.php
  96. <Files install.php>
  97. Order Allow,Deny
  98. Deny from all
  99. Satisfy all
  100. </Files>
  101.  
  102. #Protect the .htaccess
  103. <files .htaccess="">
  104. order allow,deny
  105. deny from all
  106. </files>
  107.  
  108. <Files ~ "^.*\.([Hh][Tt][Aa])">
  109. order allow,deny
  110. deny from all
  111. satisfy all
  112. </Files>
  113.  
  114. #Fav ico
  115. <IfModule mod_rewrite.c>
  116. RewriteEngine On
  117. RewriteBase /
  118. RewriteCond %{REQUEST_URI} !^/icon.ico$ [NC]
  119. RewriteCond %{REQUEST_URI} /favicon(s)?\.?(gif|ico|jpe?g?|png)?$ [NC]
  120. RewriteRule (.*) /icon.ico [R=301,L]
  121. </IfModule>
  122.  
  123. #Robots
  124. <IfModule mod_rewrite.c>
  125. RewriteBase /
  126. RewriteCond %{REQUEST_URI} !^/robots.txt$ [NC]
  127. RewriteCond %{REQUEST_URI} robots\.txt [NC]
  128. RewriteRule .* /robots.txt [R=301,L]
  129. </IfModule>
  130.  
  131. #Redirect wp
  132. <IfModule mod_alias.c>
  133. RedirectMatch 301 ^/tag/$ http://any-domain-of-multisite-.com/
  134. RedirectMatch 301 ^/search/$ http://any-domain-of-multisite-.com/
  135. RedirectMatch 301 ^/category/$ http://any-domain-of-multisite-.com/
  136. </IfModule>
  137.  
  138. # Drop problematic browsers
  139. BrowserMatch ^Mozilla/4 gzip-only-text/html
  140. BrowserMatch ^Mozilla/4\.0[678] no-gzip
  141. BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  142.  
  143. # Make sure proxies don't deliver the wrong content
  144. Header append Vary User-Agent env=!dont-vary
  145. </IfModule>
  146.  
  147. # BEGIN feedburner and uploaded files adjustments.
  148. <IfModule mod_rewrite.c>
  149. RewriteEngine On
  150. RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
  151. RewriteRule ^feed/?.*$ http://feeds.feedburner.com/domain1 [L,NC,R=302]
  152. RewriteRule ^home?.*$ http://feeds.feedburner.com/domain1 [L,NC,R=301]
  153. </IfModule>
  154.  
  155. # 5G BLACKLIST/FIREWALL (2013)
  156. # @ http://perishablepress.com/5g-blacklist-2013/
  157.  
  158. # 5G:[USER AGENTS]
  159. <IfModule mod_setenvif.c>
  160. # SetEnvIfNoCase User-Agent ^$ keep_out
  161. SetEnvIfNoCase User-Agent (binlar|casper|cmsworldmap|comodo|diavol|dotbot|feedfinder|flicky|jakarta|kmccrew|nutch|planetwork|purebot|pycurl|skygrid|sucker|turnit|vikspider|zmeu) keep_out
  162. <limit GET POST PUT>
  163. Order Allow,Deny
  164. Allow from all
  165. Deny from env=keep_out
  166. </limit>
  167. </IfModule>
  168.  
  169. # 5G:[REQUEST METHOD]
  170. <ifModule mod_rewrite.c>
  171. RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
  172. RewriteRule .* - [F]
  173. </IfModule>
  174.  
  175. # 5G:[BAD IPS]
  176. <limit GET POST PUT>
  177. Order Allow,Deny
  178. Allow from all
  179. # uncomment/edit/repeat next line to block IPs
  180. # Deny from 123.456.789
  181. </limit>
  182.  
  183. #BEGIN ANTISPAMBLOG REGISTRATION
  184.  
  185. RewriteCond %{HTTP_COOKIE} !^.*97674d05a6fcf467b8e51dc408cd1163.*$
  186. RewriteRule ^wp-signup.php - [F,L]
  187.  
  188. # BEGIN Watermark Hotlinked Images
  189. <IfModule mod_rewrite.c>
  190. RewriteEngine On
  191. RewriteCond %{HTTP_REFERER} !^$
  192. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain1.com [NC]
  193. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?feeds.feedburner.com/domain1 [NC]
  194. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain2.com [NC]
  195. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain3.com [NC]
  196. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain4.com [NC]
  197. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?google.\ [NC]
  198. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?facebook.com [NC]
  199. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?twitter.com [NC]
  200. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yahoo.\ [NC]
  201. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?bing.\ [NC]
  202. RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?ixquick.com [NC]
  203. RewriteRule ^(.*\.(png|gif|jpe?g))$ /wp-content/plugins/watermark-hotlinked-images/watermark.php?img=$1 [L]
  204.  
  205. #Compress
  206.  
  207. # Remove ETags
  208. FileETag None
  209.  
  210. <ifModule mod_headers.c>
  211. Header set Connection keep-alive
  212. </ifModule>
  213. # This .htaccess file is used to speed up this website
  214. # See https://github.com/sergeychernyshev/.htaccess
  215.  
  216.  
  217. # ----------------------------------------------------------------------
  218. # Proper MIME type for all files
  219. #
  220. # Copied from the HTML5 boilerplate project's .htaccess file
  221. # https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess
  222. # ----------------------------------------------------------------------
  223.  
  224. # JavaScript
  225. # Normalize to standard type (it's sniffed in IE anyways)
  226. # tools.ietf.org/html/rfc4329#section-7.2
  227. AddType application/javascript .js .jsonp
  228. AddType application/json .json
  229.  
  230. # Audio
  231. AddType audio/ogg .oga .ogg
  232. AddType audio/mp4 .m4a .f4a .f4b
  233.  
  234. # Video
  235. AddType video/ogg .ogv
  236. AddType video/mp4 .mp4 .m4v .f4v .f4p
  237. AddType video/webm .webm
  238. AddType video/x-flv .flv
  239.  
  240. # SVG
  241. # Required for svg webfonts on iPad
  242. # twitter.com/FontSquirrel/status/14855840545
  243. AddType image/svg+xml .svg .svgz
  244. AddEncoding .gzip .svgz
  245.  
  246. # Webfonts
  247. AddType application/vnd.ms-fontobject .eot
  248. AddType font/ttf .ttf
  249. AddType font/otf .otf
  250. AddType application/x-font-woff .woff
  251.  
  252. # Assorted types
  253. AddType image/x-icon .ico
  254. AddType image/webp .webp
  255. AddType text/cache-manifest .appcache manifest
  256. AddType text/x-component .htc
  257. AddType application/xml .rss .atom .xml .rdf
  258. AddType application/x-chrome-extension .crx
  259. AddType application/x-opera-extension .oex
  260. AddType application/x-xpinstall .xpi
  261. AddType application/octet-stream .safariextz
  262. AddType application/x-web-app-manifest+json .webapp
  263. AddType text/x-vcard .vcf
  264. AddType application/x-shockwave-flash .swf
  265. AddType text/vtt .vtt
  266.  
  267. # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
  268. <IfModule mod_setenvif.c>
  269. <IfModule mod_headers.c>
  270. SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
  271. RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
  272. </IfModule>
  273. </IfModule>
  274.  
  275. # --------------------------------------------------------------------------------------
  276. # Compression: http://code.google.com/speed/page-speed/docs/payload.html#GzipCompression
  277. # --------------------------------------------------------------------------------------
  278. <IfModule mod_deflate.c>
  279. AddOutputFilterByType DEFLATE application/atom+xml
  280. AddOutputFilterByType DEFLATE application/json
  281. AddOutputFilterByType DEFLATE application/xhtml+xml
  282. AddOutputFilterByType DEFLATE application/xml
  283. AddOutputFilterByType DEFLATE text/css
  284. AddOutputFilterByType DEFLATE text/html
  285. AddOutputFilterByType DEFLATE text/plain
  286. AddOutputFilterByType DEFLATE text/x-component
  287. AddOutputFilterByType DEFLATE text/xml
  288.  
  289. # The following MIME types are in the process of registration
  290. AddOutputFilterByType DEFLATE application/xslt+xml
  291. AddOutputFilterByType DEFLATE image/svg+xml
  292.  
  293. # The following MIME types are NOT registered
  294. AddOutputFilterByTypeByType DEFLATE application/mathml+xml
  295. AddOutputFilterByTypeByType DEFLATE application/rss+xml
  296.  
  297. # JavaScript has various MIME types
  298. AddOutputFilterByType DEFLATE application/javascript
  299. AddOutputFilterByType DEFLATE application/x-javascript
  300. AddOutputFilterByType DEFLATE text/ecmascript
  301. AddOutputFilterByType DEFLATE text/javascript
  302.  
  303. # .ico files and other compressible images
  304. AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
  305. AddOutputFilterByType DEFLATE image/x-icon
  306. AddOutputFilterByType DEFLATE image/bmp
  307. AddOutputFilterByType DEFLATE image/tiff
  308. AddOutputFilterByType DEFLATE application/pdf
  309.  
  310. # compressible fonts (.woff is already compressed)
  311. AddOutputFilterByType DEFLATE font/opentype
  312. AddOutputFilterByType DEFLATE application/x-font-ttf
  313. AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  314. </IfModule>
  315.  
  316. # ----------------------------------------------------------------------
  317. # Enabling filename rewriting (file.XXX.ext) if URL rewriting is enabled
  318. # Otherwise URLs will use query strings (file.ext?v=XXX)
  319. #
  320. # More proxies cache assets if there is no query string
  321. # ----------------------------------------------------------------------
  322. <IfModule mod_rewrite.c>
  323. RewriteEngine On
  324.  
  325. # Setting up an environment variable so your code can detect if mod_rewrite rules are executable
  326. # in this folder and you can use file.123.jpg or you need to fall back to file.jpg?123
  327. RewriteRule . - [E=URLVERSIONREWRITE:YES]
  328.  
  329. # Rewrites a version in file.123.jpg as well as timestamped version file.123_m_12345123512354.jpg
  330. # to original file.jpg so you can use it instead of file.jpg?123 which isn't cached in some proxies.
  331. RewriteCond %{REQUEST_FILENAME} !-f
  332. RewriteRule ^(.*)\.(\d+)(_m_\d+)?\.([^\.]+)$ $1.$4 [L,QSA]
  333.  
  334. # Rewrites a version in file.ac123fe.jpg to original file.jpg
  335. # so you can use it instead of file.jpg?123 which isn't cached in some proxies.
  336. # Used for hash-based URLs where having a timestamp is not necessary.
  337. RewriteCond %{REQUEST_FILENAME} !-f
  338. RewriteRule ^(.*)\.([a-z\d]+)\.([^\.]+)$ $1.$3 [L,QSA]
  339. </IfModule>
  340.  
  341. # ----------------------------------------------------------------------
  342. # Expires headers (for better cache control)
  343. # ----------------------------------------------------------------------
  344.  
  345. # These are pretty far-future expires headers.
  346. # They assume you control versioning with filename-based cache busting
  347. # Additionally, consider that outdated proxies may miscache
  348. # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
  349.  
  350. # If you don't use filenames to version, lower the CSS and JS to something like
  351. # "access plus 1 week".
  352.  
  353. <IfModule mod_expires.c>
  354. ExpiresActive on
  355.  
  356. # Perhaps better to whitelist expires rules? Perhaps.
  357. ExpiresDefault "access plus 1 month"
  358.  
  359. # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
  360. ExpiresByType text/cache-manifest "access plus 0 seconds"
  361.  
  362. # Your document html
  363. ExpiresByType text/html "access plus 0 seconds"
  364.  
  365. # Data
  366. ExpiresByType application/json "access plus 0 seconds"
  367. ExpiresByType application/xml "access plus 0 seconds"
  368. ExpiresByType text/xml "access plus 0 seconds"
  369. ExpiresByType application/pdf "access plus 1 year"
  370. ExpiresByType application/x-shockwave-flash "access plus 1 year"
  371.  
  372. # Feed
  373. ExpiresByType application/atom+xml "access plus 1 hour"
  374. ExpiresByType application/rss+xml "access plus 1 hour"
  375. ExpiresByType application/mathml+xml "access plus 1 year"
  376. ExpiresByType application/xslt+xml "access plus 1 year"
  377.  
  378. # Favicon (cannot be renamed)
  379. ExpiresByType image/x-icon "access plus 1 year"
  380.  
  381. # Media: images, video, audio
  382. ExpiresByType image/bmp "access plus 1 year"
  383. ExpiresByType image/gif "access plus 1 year"
  384. ExpiresByType image/jpeg "access plus 1 year"
  385. ExpiresByType image/png "access plus 1 year"
  386. ExpiresByType image/svg+xml "access plus 1 year"
  387. ExpiresByType image/tiff "access plus 1 year"
  388. ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
  389. ExpiresByType video/x-flv "access plus 1 year"
  390. ExpiresByType image/webp "access plus 1 year"
  391. ExpiresByType video/mp4 "access plus 1 year"
  392. ExpiresByType video/ogg "access plus 1 year"
  393. ExpiresByType video/webm "access plus 1 year"
  394. ExpiresByType audio/ogg "access plus 1 year"
  395.  
  396.  
  397. # HTC files (css3pie)
  398. ExpiresByType text/x-component "access plus 1 month"
  399.  
  400. # Webfonts
  401. ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
  402. ExpiresByType application/x-font-ttf "access plus 1 year"
  403. ExpiresByType application/x-font-woff "access plus 1 year"
  404. ExpiresByType application/font-woff "access plus 1 year"
  405. ExpiresByType font/opentype "access plus 1 year"
  406. ExpiresByType image/svg+xml "access plus 1 year"
  407.  
  408. # CSS and JavaScript
  409. ExpiresByType application/x-javascript "access plus 1 year"
  410. ExpiresByType application/javascript "access plus 1 year"
  411. ExpiresByType text/ecmascript "access plus 1 year"
  412. ExpiresByType text/javascript "access plus 1 year"
  413. ExpiresByType text/css "access plus 1 year"
  414.  
  415. </IfModule>
  416.  
  417. # ----------------------------------------------------------------------
  418. # ETag removal
  419. # ----------------------------------------------------------------------
  420.  
  421. # FileETag None is not enough for every server.
  422. <IfModule mod_headers.c>
  423. Header unset ETag
  424. </IfModule>
  425.  
  426. # Since we're sending far-future expires, we don't need ETags for
  427. # static content.
  428. # developer.yahoo.com/performance/rules.html#etags
  429. FileETag None
  430.  
  431. # ----------------------------------------------------------------------
  432. # UTF-8 encoding
  433. # ----------------------------------------------------------------------
  434.  
  435. # Use UTF-8 encoding for anything served text/plain or text/html
  436. AddDefaultCharset utf-8
  437.  
  438. # Force UTF-8 for a number of file formats
  439. AddCharset utf-8 .atom .css .js .json .rss .vtt .xml
  440.  
  441. # Block access to "hidden" directories or files whose names begin with a
  442. # period. This includes directories used by version control systems such as
  443. # Subversion or Git.
  444. <IfModule mod_rewrite.c>
  445. RewriteCond %{SCRIPT_FILENAME} -d [OR]
  446. RewriteCond %{SCRIPT_FILENAME} -f
  447. RewriteRule "(^|/)\." - [F]
  448. </IfModule>
  449.  
  450. # Block access to backup and source files. These files may be left by some
  451. # text/html editors and pose a great security danger, when anyone can access
  452. # them.
  453. <FilesMatch "(\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">
  454. Order allow,deny
  455. Deny from all
  456. Satisfy All
  457. </FilesMatch>
  458.  
  459. # BEGIN WordPress
  460. RewriteEngine On
  461. RewriteBase /
  462. RewriteRule ^index\.php$ - [L]
  463.  
  464. # add a trailing slash to /wp-admin
  465. RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
  466.  
  467. RewriteCond %{REQUEST_FILENAME} -f [OR]
  468. RewriteCond %{REQUEST_FILENAME} -d
  469. RewriteRule ^ - [L]
  470. RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
  471. RewriteRule ^(.*\.php)$ wp/$1 [L]
  472. RewriteRule . index.php [L]
  473. # END WordPress
Advertisement
Add Comment
Please, Sign In to add comment