count unique ips in apache access log

awk '{!a[$1]++}END{for(i in a) if ( a[i] >10 ) print a[i],i }'

list all apache loaded modules

apache2ctl -t -D DUMP_MODULES

.htaccess examples

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ $1.php [L,QSA] 
# http://domain/about -> http://domain/about.php 

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 
# http://domain/about -> http://domain/index.php?q=about 

force download .htaccess

AddType application/octet-stream .doc .mov .avi .pdf .xls .mp4

redirects "www.site.com" to "site.com" with .htaccess

RewriteCond %{HTTP_HOST} ^www.(.*) 
RewriteRule ^(.*) http://%1/$1 [L,R=301] 

generating a .htpasswd file

htpasswd -bc .htpasswd user pass 

Password protecting your pages with htaccess

create a .htaccess file with this content. the .htpasswd contains a user and encrypted password (e.g.: leo:4tHAiRmQ4OpjM). create a encrypted password in: http://www.kxs.net/support/htaccess_pw.html
AuthUserFile /home/leonardo/public_html/project/.htpasswd
AuthGroupFile /dev/null
AuthName "Restricted Access"
AuthType Basic
<limit GET>
require valid-user
</limit>

activing php_auth on dreamhost

by default, dreamhost runs php as cgi. the follow line switchs from cgi to apache module execution, supporting php_auth.
// create a .htaccess with this: 
AddHandler application/x-httpd-php .php
Displaying all 8 Code