httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dick Gregor <>
Subject Re: [users@httpd] REQUEST_URI multiple wildcard pattern
Date Wed, 04 May 2011 15:53:58 GMT

dick gregor. PE

Arunkumar Janarthanan <> wrote:

Hi Lee,

sorry for posting the requirement as it is, this is what the requirement exactly.

1.* - no redirection at all  (so urls like esweepconfirm/thank-you/
do not redirect)
2.* - no redirection at all
3.* - no redirection at all
4.* - no redirection at all
5. - no redirection at all
6. All other - redirect to

Best Regards,
Arun J

On Sat, Apr 30, 2011 at 7:44 AM, Lee Goddard <<>>
Hi Arunkumar

You wrote,

I could use !^/(files|admin|user|product|go), however this would allow all wildcard pattern
for the URI string like "user/login" ? or "products/newarrival" ?

This is not true. Nothing beginning with the words files, or admin, or user, or product, or
go, would match.

You do not need to terminate the pattern with a wildcard -- you have a match at the beginning.

What is it exactly that you are trying to achieve?


On 30/04/2011 12:44, Arunkumar Janarthanan wrote:
Thanks Lee, for your reply.

I could use !^/(files|admin|user|product|go), however this would allow all wildcard pattern
for the URI string like "user/login" ? or "products/newarrival" ?

Is why I tried with (.*) but the wildcard string still not getting picked up by the rule.

On Sat, Apr 30, 2011 at 2:22 AM, Lee <<>>

On 30/04/2011 05:46, Arunkumar Janarthanan wrote:
> Hi,


> I have a request that the site contains specific URI pattern

> go to another URL while the other URI patterns goes to 404
page of

> external site.


> Here below the rule I have written, however this is not
working for

> wildcard match of the URI pattern.


> RewriteCond %{REQUEST_URI}

> !^/(files(.*)|admin(.*)|user(.*)|product(.*)|go(.*))$
RewriteRule .*

> [R=301,NC,L]

RewriteCond %{REQUEST_URI} !^/(files|admin|user|product|go)

Round brackets are good for grouping OR clauses (produce|admin),
and good for storing back-references (.*). But you are not using
back-references, so you can drop a lot of those brackets. Also,
you can simply your use of the gobble-everything operator (.*)
 by putting it at the end - although why would you need it?

You simply need to match a few phrases at the beginning of the


    ! If REQUEST_URI does not match
    ^ from the start
    / oblique
    (files|admin|user|product|go) any of these phrases


View raw message