My domain only works in certain format.

October 29, 2014 727 views

I can load my domain if it is typed domain.com, but www.domain.com does not load.

My 000-default.conf is written like so:

<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Not sure what give?

1 comment
  • Go under DNS > Choose your domain and click View > go to add record > choose CNAME > Under "Enter Name" put "www" (without quotes) and under "Enter Hostname" enter your domain like this: example.com

1 Answer

Have you configured DNS for www?

if it's a CNAME, it should point to domain.com

if it's an A record, it should point to the IP address of the server.

Have another answer? Share your knowledge.