httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dayton Jones <e...@gecko.org>
Subject Re: [users@httpd] mod_rewrite help
Date Fri, 03 Nov 2006 17:03:22 GMT
Joshua Slive wrote:
> On 11/3/06, Dayton Jones <edge@gecko.org> wrote:
>> I'm trying to use mod_rewrite and redirect http requests to https ..
>> this is working great, but I need to exlude a specific directory, it has
>> to remain http.
>>
>> I've googled, and read the mod_rewrite documentaion but just can't
>> figure this out.  Here is the relevant section from httpd.conf (apache
>> 2.0.52 running on RHEL 4)
>>
>>     <VirtualHost xxx.xxx.xxx.xxx:80>
>>             ServerAdmin noone@nospam.org
>>             DocumentRoot /vhost/myweb
>>             ServerName www.mydomain.com
>>             RewriteEngine on
>>
>>             RewriteCond   %{REQUEST_URI}  ^/nonssl/$
>>             RewriteRule ^/(.*)$ http://www.mydomain.com/nonssl/$1 [L,R]
>>
>>             RewriteCond   %{SERVER_PORT}  !^443$
>>             RewriteRule ^/(.*)$ https://www.mydomain.com/$1 [L,R]
>>     </VirtualHost>
>>
>> I've tried:
>>     %{REQUEST_URI}  ^/nonssl/.*
>>     %{REQUEST_URI}  ^/nonssl/*
>>     %{REQUEST_URI}  ^/nonssl
>>
>> and none have worked.  What would be the correct RewriteCond and/or
>> RewriteRule to redirect all requests except for
>> http://www.mydomain.com/nonssl/ to https://www.mydomain.com/ ?
>
> RewriteCond %{REQUEST_URI} !^/nonssl
> RewriteRule (.*) https://www.mydomain.com$1 [L,R]
>
> The ServerPort test isn't necessary since you are inside a port-80 vhost.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

Ah, thanks.  That worked perfectly.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message