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.
Try this: ## .htaccess file RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
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.
@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...??
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.
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.
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.
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.
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.
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.