Home .htaccess: Rewrite domains to subdirectories automatically
 I have this directory structure: /default/... /www.example.com/... /www.anotherone.net/... /.htaccess  My goals: I want to map every request automatically to the corresponding subdirectory of the requested hostname. Example: www.mysite.com will be served from the subdirectory with the same name. If a domain is requested, that is not represented by a subdirectory, the domain shall be served from the "default" subdirectory. Example: There is no directory /www.newsite.info, therefore it will be served from /default. It shall not be possible to request http://www.example.com/www.anotherone.net or http://www.example.com/default. I'm having problems with goal #3, because that's what possible at the moment. That's my .htaccess at the moment: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} -d RewriteRule ^(.*)$%{HTTP_HOST}/$1 [L,NS] RewriteCond %{HTTP_HOST} !-d RewriteRule ^(.*)$default/$1 [L,NS]  What should I add, to deny requests like http://www.example.com/www.anotherone.net or http://www.anotherone.net/default? Unfortunately it's not possible to solve the problem via virtual hosts oder httpd.conf. Thanks in advance