Report this

What is the reason for this report?

xyz.com sites opens properly but www.xyz.com gives error. Is it coz of my Vhost Setup ?

Posted on April 10, 2013

I have setup a following VirtualHost Configuration to server my domain name(xyz.com) and subfolder accordingly. The file is as follows

<VirtualHost *:80> ServerAdmin info@socialcosmo.com ServerName socialcosmo.com ServerAlias www.socialcosmo.com

DocumentRoot /var/www/projectheena
<Directory />
	Options FollowSymLinks
	AllowOverride None
</Directory>
<Directory /var/www/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride All
	Order allow,deny
	allow from all
</Directory>

Alias /blog /var/www/notes
<Directory /var/www/notes>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>



Alias /admin /var/www/admin
<Directory /var/www/admin>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>



ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
	AllowOverride None
	Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
	Order allow,deny
	Allow from all
</Directory>



ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

When i hit xyz.com or xyz.com/blog, it works properly. But typing www.xyz.com in browser gives me an error saying

Oops! Google Chrome could not find www.socialcosmo.com

Can somebody point me out where i have gone wrong ?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Your apache configuration is correct and the easiest way to have www.xyz.com load the same content as xyz.com is just to add a : <br> <br>ServerAlias www.xyz.com <br> <br>So it most likely means that your DNS for www.xyz.com is misconfigured. <br> <br>When you ping it does it resolve to the same IP as xyz.com?

I am having the same problem. I added the A record www.mydomain.com over an hour ago but it still does not work. I also have the ‘ServerAlias www.mydomain.com’ entry with no luck. When I ping www.mydomain.com it says unknown host.

@brightfielddev: What’s the domain name?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.