简体   繁体   中英

http site doesn't forward to https on IE

My website has an SSL cert (example url: https://subdomain.example.com ). Under Apache it's set up for both port 80 and port 443. So under the following configuration, anyone who goes to http://subdomain.example.com is sent to https://subdomain.example.com . But for visits from Internet Explorer, the redirect doesn't happen. Instead, http visits get a "Internet Explorer cannot display the web page." with a list of client-side solutions to try.

Any ideas on how to fix IE?--that is make it go from http to https like the rest do?

Here is my config:

NameVirtualHost *:443

<VirtualHost *:80>
  DocumentRoot /var/www/somewebroot
  ServerName subdomain.example.com
</VirtualHost>

<VirtualHost *:443>
     DocumentRoot /var/www/somewebroot
     ServerName subdomain.example.com
    #   SSL CERTS HERE
</VirtualHost>

*Tested IE8, IE9 beta

EDIT

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https:///%{SERVER_NAME}/$1 [R,L]

It look's like you have a extra slash in your rewrite rule, 3 slashes instead of 2 after https.

/Viktor

Hmmm... this seems to work for all browsers:

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM