Re: SSL Redirect
Jim Hayter wrote:
> lark wrote:
>> Jim Hayter wrote:
>>> lark wrote:
>>>> lark wrote:
>>>>> Hello All,
>>>>>
>>>>> I do not think that I have a unique situation and/or configuration
>>>>> problem but for some reason I can't find anything on this problem
>>>>> out there.
>>>>>
>>>>> Here's the problem:
>>>>>
>>>>> I have a single apache (1.3) server with an ssl site configured
>>>>> correctly on port 443. We have an intranet environment where it is
>>>>> acceptable to connect to this apache server on port 80 but this
>>>>> server also serves ineternet requests and I want all those requests
>>>>> to automatically roll over to port 443.
>>>>>
>>>>> So for example if the request is coming from an ip address that
>>>>> looks like this "10.5.100.200" it may go to port 80 but any other
>>>>> requesting ip address (other than starting with 10.x.x.x) should
>>>>> roll over to port 443.
>>>>>
>>>>> If you can me out, I thank you in advance.
>>>>>
>>>>> Shawn
>>>>
>>>>
>>>> i put this and it appears is not working:
>>>>
>>>> RewriteEngine On
>>>> RewriteCond %{HTTP_REFERER} !^10\. [NC]
>>>> RewriteRule ^(.*) https://%{SERVER_NAME}$1 [R,L]
>>>>
>>>> Any thoughts????
>>>>
>>>> thanks in advance.
>>>
>>> Try using (untested):
>>>
>>> RewriteCond %{REMOTE_ADDR} !^10\.
>>> RewriteRule ...
>>>
>>> Remember to put this where it will only be invoked if the connection
>>> is not already secure, otherwise you will create a loop.
>>>
>>> Jim
>>
>>
>> Well, there is no effective way for me to know that; so, I was
>> thinking maybe I can put in another rule such as this:
>>
>> RewriteRule %{SERVER_PORT} = 80
>>
>> to make sure it only fires off when and if server port is 80!
>>
>> What do you think?
>>
>> If this is possible, which rules should be listed first, i wonder?
>>
>> thanks
>
> That's not a rule. You want to do it as another condition. RewriteCond
> are anded by default. Just put multiple RewriteCond statements
> preceding your RewriteRule.
>
> Jim
Good deal! I added the conditions one after the other and the rule right
after them. i'll have to test from home to see how it works. thanks much
for your time.
shawn
|