Take the 2-minute tour ×

I'm looking to set up VirtualHosts on my apache server and was looking for documentation that would tell me if these 2 entries are identical

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example1.com

<VirtualHost *:80>
DocumentRoot /www/example1
ServerName example1.com

Notice the lack of www. in the second one.


share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

This is from the Apache docs (http://httpd.apache.org/docs/2.0/mod/core.html#servername):

The ServerName directive sets the hostname and port that the server uses to identify itself. This is used when creating redirection URLs. For example, if the name of the machine hosting the web server is simple.example.com, but the machine also has the DNS alias www.example.com and you wish the web server to be so identified, the following directive should be used:

ServerName www.example.com:80

So I guess they are not identical.

share|improve this answer
add comment

Your Answer


