I've spent a lot of time looking for a solution for this problem but havent had any luck getting it to work. So here it goes. I have the following directory structure for my users: /home/users/domain1.com/www /home/users/domain1.com/sub1 /home/users/domain1.com/sub2 /home/users/domain2.com/www /home/users/domain3.com/www My virtual host looks like this <VirtualHost 220.127.116.11:80> UseCanonicalName off VirtualDocumentRoot /home/users/%2+/%1 VirtualScriptAlias /home/users/%2+/%1 </VirtualHost> So basically when a user goes to http://www.domain1.com he'll get the content of /home/users/domain1.com/www When he goes to sub1.domain1.com, he'll get /home/users/domain1.com/sub1 So far so good, everything works fine as long as there is a "www" prefix in the url. However when user goes to http://domain1.com i get a 404 error since the requested directory becomes /home/users/com/domain1 which is obviously incorrect. Is there a way to add "www" for all domains that do not include "www" such as domain1.com => www.domain1.com I've tried a bunch of rewrite rules but they did not seem to work. Anyone knows a solution? Thanks.