Http to Https redirection issue.

Discussion in 'Installation/Configuration' started by Sammy01, Jul 17, 2016.

  1. Sammy01

    Sammy01 New Member

    Hello, I face following problem.
    I have a domain name which works perfectly with http but I want it automatically redirect to https.
    I tried following .htaccess codes but no luck. I suspect that there is something that needs to be done with port 443.

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^mail.server.com [NC]
    RewriteRule ^/(.*)$ https://mail.server.com/$1 [R,L]
    Code:
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
    This Web panel is great no complains, but I decided to post as I wasn't unable to do it after lots of browsing.

    Thanks & warm Regards.
     
  2. vk3heg

    vk3heg Member

  3. Sammy01

    Sammy01 New Member

    i get following error:
    [​IMG]

    It does redirect me to https, but gives above error.
     
  4. Farsus

    Farsus New Member

    if you are testing 3.1 try this option
     

    Attached Files:

  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Check the cms that you instaleld in that site, if the cms is configured with a http url so that it automatically redirects back to http, then you get a loop when you instruct apache to redirect to https.
     
  6. Sammy01

    Sammy01 New Member

    @Farsus I tried that way but no luck.
    @till, I have just a basic HTML template in it.
    The thing is I want to use Cloudflare's SSL with my domain.
    Also the site is running on port 80, dnt you think it should be on 443...??
     
    Last edited: Jul 18, 2016
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    The site has to be working on ssl first before you can add a redirect. so you should first enable ssl and check that the site works.
     
  8. Sammy01

    Sammy01 New Member

    I did Enable SSL and Create a certificate from SSL tab on the Domain in ISPConfig Panel. But still the website does not work on https, it just gets redirected to the http.

    Heyy till Thank You so much for your help, I really appreciate it.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig is not doing a https to http redirect, so the redirect must be in your cms, in a .htaccess file or cloudflare is doing it.
     
  10. Sammy01

    Sammy01 New Member

    See I tried 2 things.
    1. Redirect via .htaccess (I have posted above the types of .htaccess codes that I have implemented and not succeeded)
    2. The https via Cloudflare works well but the issue is I need to manually type https in address bar, and if I put .htaccess to redirect website to https it says "ERR TOO MANY REDIRECTS".

    What exactly I am trying to achieve is that my website should load only via https and I have implemented CloudFlare's free SSL on it.
    Thanks and warm Regards.
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    You said in #8 that the site is doing a https to http redirect at the moment, you can not add a redirect in the other direction before you disabled this redirect. Like I mentioned above, the https to http redirect is not done by ispconfig, so you have to check the cms of your website, cloudflare settings and the .htaccess file to see what causes it and after you disabed this redirect, then you can neable http to https.
     
  12. Jesse Norell

    Jesse Norell Active Member

    Also clear your browser cache / restart your web browser and/or try a different browser. Sometimes a redirect you saw in the past is remembered by your browser long after you fix/change the original cause of it.
     

Share This Page