Does not work without the WWW

April 11, 2014 854 views
Hello everyone. I'm kind of newbie in both VPS and Ubuntu LAMP server configuration. Just followed some community tutorials on how to instal ubuntu and then apache, php, mysql, etc. My goal is to have some domains hosted in the same droplet so I followed the virtual hosts tutorials. The problem is that my domain is working with the WWW but it's not working without it: http://www.xcuse.me/ working http://xcuse.me/ not working After reading a lot, I haven't found anything similar to this. Can someone help me? Thank you so much!
5 Answers
In the DNS settings create an 'A' record with hostname: '@' and IP Address: . 'WWW' should be set as 'CNAME' record of '@'
Thank you edwingonzales1123!
I already have that (followed the tutorials) but the problem is exactly the oposite. It works fine if I put the "WWW" but it doesn't work if I just type "xcuse.me", it shows the directory contents from the /var/www folder.

Please pastebin your virtualhost config.
Hello Kamal. Thank you for your help!
I think I got it to work now.

I had 2 virtualhosts ... the default one and the one for xcuse.me
In the default one, the document root was pointing to /var/www and I changed it to /var/www/xcuse.me/public_html and it's working now. Don't know if it is the best way but I'll move on now :) need to prototype this app asap hehe

Thank you again for your help (and edwingonzales1123 too).
That is the proper way to fix it :) Glad to hear it's working properly now!
Have another answer? Share your knowledge.