I have this virtualhost in /etc/apache2/sites-available/cv.conf
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/cv/web
<Directory /var/www/cv/web>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/cv_error.log
CustomLog ${APACHE_LOG_DIR}/cv_access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com [OR]
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
The lines Rewrite*
have been added by letsencrypt and I checked on google, it seems to be the good way to do it. But when I go to domain.com
it doesn't redirect me to https://example.com
(it loads the 000-default.conf). Nevertheless it is redirecting me to https://www.example.com
when I go on www.example.com
Do you have any idea? I don't know how to debug this. The logs are confirming what I am saying, the cv_access.log does not print any request when I go on domain.com
.