Something like this on Apache: ServerName yourserver.org DocumentRoot /path/to/webinterface/www CustomLog /var/log/apache/access_chessd.log combined ErrorLog /var/log/apache/error.log ScriptAlias /cgi-bin/ /home2/chessd/www/cgi-bin/ RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-F RewriteRule ^/users(/([^/]+)(/([^/]+)/?|/?)|/?)$ /user/index.php?username=$2&action=$4&%{QUERY_STRING} and edit include/connect.php .