Joshua Slive wrote:
On 11/3/06, Dayton Jones <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
            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: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

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: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to