Question

Files on the server loads only when it is accessed through www

  • Posted on January 28, 2015
  • ChempoAsked by Chempo

So I have image on the server located in the images folder.

It serves as a Thumbnail when my site is shared on social media.

But, it can only be viewed when you go to my site with www:

http://www.chempo.com/images/thumbnail.png

and if you remove www it shows 404:

http://chempo.com/images/thumbnail.png

Does anybody know what is the problem? What do I need to do to fix this?

Thanks in advance.

P.S.

My droplet is on Ubuntu 14.04

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Open a console terminal and type:

cd /etc/apache2/sites-available

I don’t know how you setup your website via configuration but open the correct file that’s associated with chempo.com.

In there, there will be a line that probably says:

ServerName www.chempo.com

Underneath it, add this:

ServerAlias chempo.com

Save and restart apache2

service apache2 restart

Hopefully, that should allow web requests with and without www.