Question

I'm encountering an issue with redirection. If I try to access https://www.mydomain.com/mypage/, I'm getting redirected to https://www.mydomain.commypage that does not exist. I'm losing the slash.

As you can see, I have to solve by adding a new directive, but I cannot do it for every page..

I do not use rewriting but redirect. I run with apache2 and GNUTls.

Here is the default site that makes the redirection:

NameVirtualHost *:80

<VirtualHost *:80>
   ServerName www.mydomain.com
   ServerAlias mydomain.com
   Redirect permanent /XXXXXX.htm https://mydomain.com/XXXXXX.htm
   Redirect permanent / https://www.mydomain.com
   DirectorySlash On
</VirtualHost>

<VirtualHost *:80>
   ServerName www.mydomain.fr
   ServerAlias mydomain.fr
   Redirect permanent / http://www.mydomain.com
</VirtualHost>

Thanks a lot for your help.

Was it helpful?

Solution

I had and solved this issue. Here is my VirtualHost file (/etc/apache2/sites-enabled/000-default.conf):

<VirtualHost *:80>
        ServerName mydomain.me
        Redirect permanent / https://mydomain.me/
</VirtualHost>
<VirtualHost *:443>
     ServerName mydomain.me
     DocumentRoot /var/www/html
     SSLEngine On
     SSLCertificateFile /etc/apache2/ssl/mydomain.me.crt
     SSLCertificateKeyFile /etc/apache2/ssl/luketaverne.me.key
     SSLCACertificateFile /etc/apache2/ssl/luketaverne.me.cer

     ServerAdmin info@mydomain.me
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top