Re: [users@httpd] mod_rewrite help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/3/06, Dayton Jones <edge@xxxxxxxxx> 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@xxxxxxxxxx
            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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux