skip to Main Content

I’m trying to configure my Apache Server to redirect both:
Non-SSL http://support.nile.sd and SSL https://support.nile.sd to the link https://support.nile.sd/otrs/customer.pl, HTTP requests are well redirected via this force-redirect.conf:

    $ vim /etc/httpd/conf.d/force-redirect.conf
       <VirtualHost *:80>
        ServerName support.nile.sd
        Redirect permanent / https://support.nile.sd/otrs/customer.pl
       </VirtualHost>

But HTTPS aren’t redirected!! it goes to a strange page as follows:

Index of /

Name Last modified Size Description

Could you please tell me how to redirect HTTPS also, without having the “Too many redirects ERROR”

2

Answers


  1. Chosen as BEST ANSWER

    Now it works, I used the RedirectMatch expression, on both HTTP and HTTPS Virtual hosts as follows in the same force-redirect.conf file:

    <VirtualHost *:80>
     ServerName support.nile.sd
     RedirectMatch permanent (.*)/$ https://support.nile.sd/otrs/customer.pl
    </VirtualHost>
    
    <VirtualHost *:443>
     ServerName support.nile.sd
     RedirectMatch permanent (.*)/$ https://support.nile.sd/otrs/customer.pl
     SSLEngine On
     SSLCertificateFile /etc/letsencrypt/live/support.nile.sd/certificate.pem
     SSLCertificateKeyFile /etc/letsencrypt/live/support.nile.sd/privatekey.pem
     SSLCertificateChainFile /etc/letsencrypt/live/support.nile.sd/chainofgod.pem   
    </VirtualHost>
    

  2. You only have a rule for port 80, which is regular http:// protocol

    I don’t see a rule for port 443, which is https

    you need to add the following

    <VirtualHost *:443>
     ServerName support.nile.sd
     DocumentRoot /var/www/site
     SSLEngine on
     SSLCertificateFile /path/to/www_yoursite_com.crt
     SSLCertificateKeyFile /path/to/www_yoursite_com.key
     SSLCertificateChainFile /path/to/DigiCertCA.crt
    
     Redirect permanent / https://support.nile.sd/otrs/customer.pl
    </VirtualHost>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search