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?
Lee
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 <leegee@xxxxxxxxx>
wrote:
On 30/04/2011 05:46, Arunkumar Janarthanan wrote:
> Hi,
>
> I have a request that the site contains specific
URI pattern
should
> 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 .*
> http://www.abc.com/page-not-found
[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
string.
So:
! If REQUEST_URI does not match
^ from the start
/ oblique
(files|admin|user|product|go) any of these phrases
HTH
Lee
|