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

Reply via email to