Forum Moderators: phranque

Message Too Old, No Replies

mod vhost and ServerAlias

Serve both www.domain.com and domain.com

         

gojuka

8:11 pm on Aug 15, 2006 (gmt 0)

10+ Year Member



Hi All

Im looking for a way to serve documents using the mod_vhost module. Im using the module like so:

VirtualDocumentRoot /home/webuser/%0

Then the user can ftp to his account, create the directory for the domain (e.g testing.com) and place all the docs he wants to serve from it, and voila, an automatic virtual host, but only for [domain.com....] The problem is that I want to serve docs for both domain.com and www.domain.com automatically. Using this method the user has to create two directories (www.domain.com and domain.com) and then upload the files twice. I want to avoid the second step.

I know that for non-vhost setups I can use the ServerAlias directive, but I dont think that will work in this case. Can anyone help?

Thanks!

jdMorgan

9:32 pm on Aug 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'd be far better off redirecting the www subdomain to the (non-www) domain or vice-versa, at the top (config) level. Otherwise, you are encouraging your 'users' to create duplicate content, which will negatively affect their page's ranking in search. Otherwise, you could use mod_rewrite or mod_alias to map the www to non-www subdirectories, but this would only make more work for you as an admin, and create the duplicate content problems.

Jim