Hello everyone,
I have my pi running debian buster. I set up a cloud with the subdomain cloud.example.com and a website as example.com. I installed SSL using certbot. It seems all to be working except that if I type http://www.example.com it doesn't rewrite to https://www.example.com. All other rewrite rules are working fine. What could be the problem that the www.example.com doesn't automatically redirect?
I have the files in the folder /etc/apache2/sites-available:
1. www.example.com.conf:
2. example.com.conf
3. nextcloud.conf
Thanks for your help already!
I have my pi running debian buster. I set up a cloud with the subdomain cloud.example.com and a website as example.com. I installed SSL using certbot. It seems all to be working except that if I type http://www.example.com it doesn't rewrite to https://www.example.com. All other rewrite rules are working fine. What could be the problem that the www.example.com doesn't automatically redirect?
I have the files in the folder /etc/apache2/sites-available:
1. www.example.com.conf:
Apache config:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/example.com_error.log
CustomLog ${APACHE_LOG_DIR}/example.com_access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
2. example.com.conf
Apache config:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/example.com_error.log
CustomLog ${APACHE_LOG_DIR}/example.com_access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
3. nextcloud.conf
Apache config:
Alias /nextcloud "/var/www/nextcloud/"
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/nextcloud
ServerName cloud.example.com
ServerAlias cloud.example.com
ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =cloud.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Thanks for your help already!