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 the config so IE visits have the same behavior as the other browsers (that is, send http to https automatically)?

1 Answer
1

If you are testing changes you may have problems with IE unless you shut down all IE windows and restart. IE can be use its cache aggressively.

EDIT: You need to ensure mod_rewrite is enabled. Command is a2enmod rewrite. It will tell you if the module is already enabled. If not you will need to shutdown and restart the server after enabling the module.

Add the lines above to your virtual host definition and use apache2ctl graceful to reload the modified configuration. The Apache documentation has details on rewriting.

You should see the redirect as a 301 status request in your access log followed by a 200 or 304 status on the HTTPS connection. The displayed URL should change to the new location.

Logging the port in an extend log format helps to see which connection things are happening on. Alternatively, use separate logs for each virtual server.