View Single Post

  #7 (permalink)  
Old 07-10-2003
Rossz
 
Posts: n/a
Default Re: mod_rewrite, redirecting https

google@dearing.us (Ryan) wrote in
news:8a734383.0307091305.35ee6b28@posting.google.c om:

> Justin Koivisto <spam@koivi.com> wrote in message
> news:<a0WOa.36$m3.2636@news7.onvoy.net>...
>> Ryan wrote:
>>
>> > How would I go about redirecting 1 directory to https?
>> >
>> > For example, http://www.site.com/mail would redirect to
>> > https://www.site.com/mail
>> >
>> > Ive tried numerous things with mod_rewrite but I cant get them to
>> > work, maybe Im putting them in the wrong spot.

>>
>> I'll assume that you had already tried this then:
>> RewriteRule http://www.site.com/mail https://www.site.com/mail
>>
>> What about adding a condition checking the protocol? Now sure if this
>> is correct since I've never had to do this...
>>
>> RewriteEngine On
>> RewriteBase /
>> RewriteCond %{SERVER_PROTOCOL} ^(http|HTTP)$
>> RewriteRule ^mail(/.*)? https://www.site.com/mail$1

>
>
> Ive tried both of these. It appears my rewrite rules dont work,
> because I cant even make simple ones work....


Try this:
RewriteCond %{SERVER_PROTOCOL} ^http$ [NC]
RewriteRule ^mail(/.*)? https://www.site.com/mail$1 [R,L]

Note the flags at the ends of the lines. If that doesn't work, try this:

RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/mail/(.*)$ https:/www.site.com/mail/$1 [R,L]

--
Rossz

Remove 'NOSPAM' from my email address to reply directly