https redirect from http

I have around 10 virtual servers hosted with virtualmin and I have applied an SSL to one of them. I would like to set up a redirect so that viewers visiting http://www.myexample.com get redirected to https://www.myexample.com.

I have setup a permenant redirect from http://www.myexample.com to https://www.myexample.com but this doesnt do anything, just goes to http.

If I set the port to 443 then I can go to https site with no problems and see the cert. If I set as 80 then I can go to http site with no problems. If I set port as any I can go to http but not https.

Any ideas?

Thanks

maybe take a look at hbmn.ca/webmail where I have a successful redirect like that.

dave

How exactly looks the line in httpd.conf file?

It must be as this:

<VirtualHost IP:80>
ServerName yourserver.dom
Redirect Permanent / https://yourdomain.dom
</VirtualHost>
<VirtualHost IP:443>
ServerName yourserver.dom
.
.
.
.
.
.
.
</VirtualHost>

I made a file called index.html in the default directory with this line in it:

<meta HTTP-EQUIV="REFRESH" content="0; url=https://www.hbmn.ca:20000">

This is a zero delay redirect. Works fine.

Dave

Another way: http://www.virtualmin.com/node/14420#comment-63125