Re: HTTP to HTTPS redirect on virtual host on port 8080

Matt Stevenson <[email protected]>
Newsgroups gmane.comp.apache.mod-ssl.user
Message-ID <[email protected]>
--- Christopher McClan <[email protected]> wrote:
> Hi,
> 
> I'm currently running an Apache web server with
> Mod_SSL, and have the
> following virtual host statement:
> 
> <VirtualHost mywebserver:8080>
>   <IfModule mod_ssl.c>
>       SSLEngine on
>       SSLCertificateFile      /xx/xxx/xxx.crt
>       SSLCertificateKeyFile   /xx/xxx/xxx.key
>       SetEnvIf User-Agent ".*MSIE.*" nokeepalive
> ssl-unclean-shutdown
>    </IfModule>
>    ServerName mywebserver
>    DocumentRoot /xxx/xxx/xxx/xxx
>    <Directory /xxx/xxx/xxx/xxx>
>      Options Indexes FollowSymLinks MultiViews
> +ExecCGI
>      Allow from all
>    </Directory>
> </VirtualHost>
> 
> If I connect using http, I get an Apache error
> stating that this an SSL
> enabled server, and I should use https.
> 
> My question is, how do I get it to redirect from
> http to https? This seems
> easy enough if you aren't running a virtual server
> on a specific port and
> just want to redirect to https for certain
> directories, but in this
> configuration I've not been able to achieve this.

You'll have to run another virtual server on another
port. Then redirect to your https server. You can't
run http/https on the same port. Suggest 8080 as http
and 8443 as https. Then ...

RewriteEngine On
RewriteLog "logs/rewrite.log"
RewriteLogLevel 0
RewriteRule ^/(.*) https://xxxx:8443/$1 [R=301,L]





		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [email protected]
Automated List Manager                            [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.