Forum Moderators: phranque

Message Too Old, No Replies

how to do a redirect from http:// to a https:// in httpd text

         

slackkun

9:27 am on Feb 7, 2005 (gmt 0)

10+ Year Member



anyone knows what is the problem with this section?
needhelp urgently thanks to all

<VirtualHost *:*>
DocumentRoot "C:\Program Files\Apache Group\Tomcat 5.0\webapps\ROOT"
ServerName 127.0.0.1
RewriteEngine On
RewriteCond %{SERVER_PORT}!^443$
RewriteRule ^/.* [%{SERVER_NAME}$1...] [R,L]

SSLEngine on
SSLCertificateFile conf/ssl/my-server.cert
SSLCertificateKeyFile conf/ssl/my-server.key
</VirtualHost>

slackkun

9:28 am on Feb 7, 2005 (gmt 0)

10+ Year Member



i have a problem with this as i enter http:// it wun redirect to https://

Caterham

2:04 pm on Feb 7, 2005 (gmt 0)

10+ Year Member



hi,

you are referencing a back-reference ($1), but the group in the pattern is missing:

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

slackkun

3:26 pm on Feb 7, 2005 (gmt 0)

10+ Year Member



hi tnks for helping, i tried enter as u said so but it still cant work as i wanted.

for example i type in [localhost...]
it will redirect to [localhost...]

what is the 301 means?

Caterham

4:00 pm on Feb 7, 2005 (gmt 0)

10+ Year Member



but your SSL-Port is 443?
Does SERVER_NAME contain your domain name? What happens?

301 is a HTTP-Statuscode: Moved Permanently. If no statuscode is specified, the status code "302 Found" will be sent (the requested resource resides temporarily under a different URI)

slackkun

6:54 pm on Feb 7, 2005 (gmt 0)

10+ Year Member



yes mi ssl port is 443 as specify in server file
my domain is currently localhost
which is 127.0.01

i wonder if
Listen 443 in httpd have any problems with this case

this is my server file for my tomcat
<!-- Define a non-SSL Coyote HTTP/1.1 Connector on the port specified
during installation -->
<Connector port="80"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->

<!-- Note : To use gzip compression you could set the following properties :

compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->

<!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
<!--
<Connector port="443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" debug="0" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->