Christian Bockermann | 11 Nov 2010 19:49

Re: Redirect URL


Hi Arun,

most likely, you do not need ModSecurity for this. mod_rewrite also allows
for using conditional rewrite. For a simple rewrite of "/" to "/test/index.html",
you can use the following:

   RewriteEngine On
   RewriteRule ^/(index.html)?$  http://www.anb.com/test/index.html  [R]

If you want to redirect all requests which are NOT targeting /test/* to /test/*
then you can use

   RewriteCond %{REQUEST_URI} ^/test
   RewriteRule ^/(.*)  http://www.anb.com/test/$1  [R]

If you want to do this with ModSecurity, you might be able to use

   SecRule REQUEST_URI !^/test  "phase:1,redirect:/test/index.html"

(I did not test the examples above. However, it should give you a faint
 idea how this works).

If you can point out what you exactly want to do (i.e. do you want to rewrite 
all requests? or only some?), then we might help you even better.

Regards,
   Chris

Am 11.11.2010 um 18:21 schrieb <Arun.NatammaiRajendran <at> cognizant.com> <Arun.NatammaiRajendran <at> cognizant.com>:

> I want to redirect the URL using mod_rewrite based on REMOTE-URI
> 
> For example if I try to access the URL http://www.anb.com it should
> redirect to http://www.anb.com/test/index.html
> 
> How I can achieve this
> 
> 
> This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may
contain confidential and privileged information.
> If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of
the original message.
> Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this
email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful.
> 
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> mod-security-users mailing list
> mod-security-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mod-security-users
> Commercial ModSecurity Appliances, Rule Sets and Support:
> http://www.modsecurity.org/breach/index.html


Gmane