Apache rewrite to ignore certain directory and all its contents

Posted by Javier Novoa C. on Server Fault See other posts from Server Fault or by Javier Novoa C.
Published on 2011-01-12T18:27:28Z Indexed on 2011/01/12 18:55 UTC
Read the original article Hit count: 233

Filed under:
|

Hi,

I'm looking for the rewrite rule for mod_rewrite in Apache so that when asking for a specific subdirectory, it and all its contents gets redirected to another location.

I currently have the following:

    RewriteEngine  on
    RewriteRule    ^/SUBDIRECTORY(/.*)?  /another/location

But this only manages to redirect /SUBDIRECTORY requests to the desired location, while all others (like (/SUBDIRECTORY/ , /SUBDIRECTORY/anything/else ) gets me an error telling me that the redirection is not valid...

any ideas?

Thanks!

© Server Fault or respective owner

Related posts about apache

Related posts about mod-rewrite