Re: simple mod_rewrite question

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

 



On 8/5/07, Michael B Allen <ioplex@xxxxxxxxx> wrote:
> Hi,
>
> I have a very simple mod_rewrite requirement but I can't seem to make it work.
>
> I want all paths to invoke a php script *except* some that begin with
> certain directories. For example, consider the following URLs:
>
> http://www.example.com/z/blog/07/10
> http://www.example.com/z/css/style.css
>
> I want the first to execute the PHP script. But if the request path
> begins with /z/css/ then I want the PHP script to NOT be executed such
> that css/style.css is retrieved as if there had been no RewriteRule at
> all.
>
> I tried the following:
>
> Alias /z/ /home/miallen/p/z/www/
> <Directory /home/miallen/p/z/www>
>    RewriteEngine On
>    RewriteBase /z
>    RewriteRule ^/css/(.*) css/$1 [L]
>    RewriteRule ^/* index.php
>    Order allow,deny
>    Allow from all
>    Options Indexes FollowSymLinks
> </Directory>
>
> The second RewriteRule works and I have seen the first rule work if I
> don't prefix it's expression with ^/ but they do not work together.

This first thing is to put the rewrite stuff in the main server
context instead of inside a <Directory> section:
RewriteRule ^/z/css - [L]
RewriteRule ^/z.* /home/miallen/p/z/www/index.php

You can alternatively use a RewriteCond %{Request_URI} to exclude some
paths from the RewriteRule.

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