Rewrite url based on IP

Hi

I am trying to rewrite a url and dont have an idea how this can be achieved.

current setup

  1. client hits a url www.hello.com
  2. this goes to the apache backend virtual host www.foo.com

What I want is

  1. client hits a url www.hello.com
  2. based on his IP we forward to different virtual hosts
  3. E.g
    client ip 10.0.0.1 this gets fowarded to virtual host www.foo.com
    client ip 172.0.0.1 this gets forded to virtual host www.bar.com

I have manged to resolve this by using src to differentiate ip and reqirep to rewrite the host