Apache2 - Virtual host redirect problem

Jan 20, 2015

I have been having issues with one of my sites on my VPS. For some reason when I go to the main address (without www) the page would show me the Apache2 default page, whilst going to the alias of the site (with www) the site would show correctly.

After numerous hours of recreating all the config files; removing all the symlinks (a2dissite) and re-enabling them (a2ensite); pulling apart all the .htaccess files; recreating all the DNS records; I still had know luck resolving the issue. In the end I removed the symlink to the 000-default.conf file and restarted appache, expecting to see the main page as unavailable and too my surprise, instead it actually worked as it should. For the moment my solution is to leave the 000-default.conf file disabled, though I am not sure if this is the best solution and all my searching hasn't given me any sort of answer.

Maybe some day in the future I might understand what actually happened here and be able to fix it properly.