Forum Moderators: phranque

Message Too Old, No Replies

Apache and SSL and Mod_rewrite

How to redirect complete Website to https

         

Uteho

9:06 am on May 3, 2004 (gmt 0)

10+ Year Member



Hallo,
I have a website which should be only accessible via ssl. I tried this redirect: ( in the virtual host for port 80)

Redirect / [my.site.de...]

But this works only with the main url, i.e. when I type in [my.site.de...] it works but when I type in my.site.de/cgi-bin/... it stops working.

I also tried the following rewrite rule from the apache Cookbook ( in the virtual host for port 80):

RewriteEngine On
RewriteCond %{HTTPS}!=on
RewriteRule ^/(.*) [%{SERVER_NAME}...] [R,L]

Which has no effekt, whatsoever. Mod_rewrite is on and working.

I need a way to pass all http:// requests on to https as there are complete URL's for flash movies in, which must be changed to https on the fly as well.

I need the url in the address line visibly changed to https.

Is it possible to archieve this with a rewrite rule and if yes, what is wrong with the above rule.

Is there another way to solve my problem with apache?

Any hints are very welcome.

Regards,
Ute

webwit

3:54 pm on May 3, 2004 (gmt 0)

10+ Year Member



Try putting this in your .htaccess file in your http directory on your server. It worked for me.

Redirect /cgi-bin [example.com...]

I hope this helps.

Cheers!

Uteho

7:52 pm on May 3, 2004 (gmt 0)

10+ Year Member



Thank you for your answer. Will this redirect all calls with cgi-bin in them or just the calls for the virtual host? I have several domains with calls to cgi-bin and I have also some other programms, which need to reach files in cgi-bin via the webserver.

Into which directory do I put it? Into the httpd webserver document root or in the document root of the virtual host or in the same directory as the httpd.conf file is or what seems most logical to me: in the cgi-bin directory?

Sorry for this newbie question...