RewriteCond %{REQUEST_URI} !^/mailman/.* RewriteCond %{REQUEST_URI} !^/pipermail/.* RewriteCond %{REQUEST_URI} !^/cgi-bin/.* RewriteCond %{REQUEST_URI} !^/icons/.* RewriteCond %{REQUEST_URI} !^/cacti/.* RewriteRule ^(.+) %{HTTP_HOST}$1 [C] RewriteRule ^([^.]+)\.([^/]+)\/(.*)$ /var/www/web/$2/$1/$3 [L] Which maps http://one.two.three/four to /var/www/web/two.three/one/four