I have those subdomains:
link.domain.com
links.domain.com
I want to redirect the link.domain.com
to links.domain.com
. For this, I used the same method as described here : Redirect subdomain to subdomain Apache2 and it works.
I installed a TLS certificate for links.domain.com
with Let's Encrypt and I can perfectly access links.domain.com
in HTTPS. I would like the redirection from link.domain.com
to links.domain.com
to be also effective in HTTPS.
Here is my conf file:
<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot /var/www/links/
ServerName links.domain.com
<Directory "/var/www/links/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error_links.log
CustomLog ${APACHE_LOG_DIR}/access_links.log combined
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
SSLCertificateFile /etc/letsencrypt/live/links.domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/links.domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
I already tried the following :
Adding
ServerAlias link.domain.com RedirectMatch permanent ^link.domain.com/(.*)$ https://links.domain.com/$1
after the
ServerName links.domain.com
line.Adding
<VirtualHost *:443> ServerName link.domain.com RedirectMatch permanent ^/(.*)$ https://links.domain.com/$1 </VirtualHost>
before and after the already defined VirtualHost.
No one worked.
Do you have any idea ?