Htaccess
untested .htaccess
ultimate spambot block
block all post and put access if not made from your own site.
RewriteCond %{HTTP_REFERER} “!.*gobloglah.com/.*$” [NC]
RewriteCond %{REQUEST_POST} “.*” [OR]
RewriteCond %{REQUEST_PUT} “.*”
RewriteRule (.*) http://dennyhalim.blogspot.com [R=301,L] #go try spam blogger.com
# RewriteRule .* - [F] #just blocking without redirecting
(maybe) better way:
SetEnvIf Referer “.*dennyhalim.com/.*$” local_referal
# Allow browsers that do not send Referer info
# SetEnvIf Referer "^$" local_referal
<limit POST PUT>
Order Deny,Allow
Deny from all
Allow from env=local_referal
</limit>
# (similar to prevent hotlinking)
<Directory /images>
Order Deny,Allow
Deny from all
Allow from env=local_referal
</Directory>
slashdotted cure
forward anyone came from slashdot/digg/fark to coral cdn proxy/cache
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !^Googlebot
RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx
RewriteCond %{QUERY_STRING} !(^|&)coral-no-serve$
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?digg\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?slashdot\.org [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?slashdot\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?fark\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?somethingawful\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?kuro5hin\.org [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?engadget\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?boingboing\.net [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?del\.icio\.us
RewriteRule ^(.*)?$ http://dennyhalim.com.nyud.net/$1 [R,L]
</ifmodule>
expire by type
ExpiresActive On
ExpiresDefault "access plus 4 hours"
ExpiresByType application/javascript A900
ExpiresByType application/x-javascript A900
ExpiresByType text/javascript A900
ExpiresByType text/html A90
ExpiresByType text/xml A90
ExpiresByType text/css A900
ExpiresByType text/plain A62
ExpiresByType image/gif A14400
ExpiresByType image/jpg A14400
ExpiresByType image/jpeg A14400
ExpiresByType image/png A14400
ExpiresByType image/bmp A14400
ExpiresByType application/x-shockwave-flash A3600
personal htaccess
this is what i put on the a cheap cluster hosting.
but prevent others use my cluster host
ExpiresActive On
ExpiresDefault A29030400
Header append Cache-Control "public"
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css|htm?|txt)$">
setOutputFilter DEFLATE
</FilesMatch>
</IfModule>
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
Mod_gzip_item_include file \.(htm?|txt|css|js|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css)$">
Header unset Last-Modified
</FilesMatch>
Header unset ETag
FileETag None
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
ExpiresActive Off
</FilesMatch>
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !^Googlebot
RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx
RewriteCond %{QUERY_STRING} !(^|&)coral-no-serve$
RewriteCond %{HTTP_REFERER} !^http://([^/]+\.)?dennyhalim\.com
RewriteRule ^(.*)?$ http://lim.nfshost.com.nyud.net/$1 [R,L]
#RewriteRule ^my-icons/(.*)?$ http://cdn.mypolaris.com.nyud.net/my-icons/$1 [R,L] #only apply to a folder
</ifmodule>
SetEnvIfNoCase User-Agent "Jakarta Commons" keep_out
SetEnvIfNoCase User-Agent "Y!OASIS/TEST" keep_out
SetEnvIfNoCase User-Agent "libwww-perl" keep_out
SetEnvIfNoCase User-Agent "MOT-MPx220" keep_out
SetEnvIfNoCase User-Agent "MJ12bot" keep_out
SetEnvIfNoCase User-Agent "Nutch" keep_out
SetEnvIfNoCase User-Agent "cr4nk" keep_out
order allow,deny
allow from all
deny from env=keep_out
ref:
- http://gobloglah.livejournal.com
- http://it.dennyhalim.com/search?q=htaccess
- http://wiki.coralcdn.org
- http://taint.org/wk/CacheControlUsingRedirects
- http://httpd.apache.org/docs/2.2/mod/mod_expires.html
- http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
- http://www.shoemoney.com/2006/09/30/the-key-to-being-anti-social-how-to-deal-with-diggs-slashdot-delicious-ect/
test to see if it works:
http://www.wannabrowser.com/
http://web-sniffer.net
http://tester.jonasjohn.de/























