Re: unexpected/bogus behavior of RedirectMatch/mod_rewrite

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

 



On 9/6/07, James Ralston <qralston+ml.apache-httpd-users@xxxxxxxxxxxxxx> wrote:

> Now, say that (for whatever reason) we want to redirect all requests
> for any URL-path except / (root) to the root.

>
> Or you could do it using mod_rewrite:
>
>     RewriteEngine On
>     RewriteCond %{REQUEST_URI} !^/$
>     RewriteRule .* http://localhost/ [redirect=permanent,last]
>
> But either approach will, in fact, fail: *all* URL-paths will return a
> redirect to the root, including the root itself.

I'm sure you could get it to work with mod_rewrite. The no-subrequest
[NS] flag might work, or you could add a RewriteCond to exclude the
index.html or you could use a RewriteCond on %{THE_REQUEST}.

In the case of mod_rewrite it is certainly desired behavior that it
act also on the aliased/expanded form of the path. If it didn't do
this, many interesting uses of mod_rewrite wouldn't be possible.

For mod_alias, I agree it would be clearer if it only acted on the raw
path, not the aliased/expanded one.

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