I'm not sure where I'm going wrong, but I cannot seem to access my website without including the www prefix in the URL, otherwise I can access it fine. I have the following DNS records:
A: @ - directs to 000.000.000.000
CNAME: *.example.com - is an alias of example.com
And in my .conf file, I have the following:
<VirtualHost *:80>
ServerName example.com
Redirect permanent / http://www.example.com/
</VirtualHost>
<VirtualHost *:80>
ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/example.com/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
The file should be working because I can access the site at www.example.com, so I'm not sure if there's a mistake in my Redirect or if it's something else, but I'm struggling to figure this out.