Re: [users@httpd] Help with mod_rewrite rules

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

 



On 8/10/06, Bill Moseley <moseley@xxxxxxxx> wrote:
I suppose the simple way is the following:

        RewriteCond %{REQUEST_URI} \.(jpe?g|gif|png|txt|doc|ppt|pdf)$
        RewriteCond %{REQUEST_URI} !/css/
        RewriteCond %{REQUEST_URI} ^/Rural                  [nocase]
        RewriteRule ^/(?:Rural/)?(.+)$ /domains/Rural/$1    [last,nocase]

        # now non-rural, do the same.

        RewriteCond %{REQUEST_URI} \.(jpe?g|gif|png|txt|doc|ppt|pdf)$
        RewriteCond %{REQUEST_URI} !/css/
        RewriteRule ^/(.+)$ /domains/default/$1             [last]

RewriteConds apply only to the RewriteRule immediately following them.
There are various ways to avoid having to write the same conds
multiple times, for example:
RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|png|txt|doc|ppt|pdf)$
RewriteCond %{REQUEST_URI} ^/css/
RewriteRule .* - [L]

RewriteRule ^/(.+)$ /domains/default/$1             [last]
RewriteRule ^/(?:Rural/)?(.+)$ /domains/Rural/$1    [last,nocase]

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