The way I would handle this is adding a second rewritecond to each stanza, 
looking at REQUEST_URI to make sure that the target path is not there, eg
  RewriteCond %{REMOTE_ADDR} ^1.1.1.1
  RewriteCond %{REQUEST_URI} !^/internal
 RewriteRule ^(.*)$ www.site.com/internal<http://www.site.com/internal> 
[R=301,L]


A
________
Aaron Macks
ama...@harvardbusiness.org<mailto:ama...@harvardbusiness.org>

On Jul 1, 2013, at 3:33 PM, "Clark, Kim" 
<kcl...@carlsonwagonlit.com<mailto:kcl...@carlsonwagonlit.com>> wrote:

I am new to apache, so forgive me if this is a beginner questions.

I am trying to redirect request to apache based on the IP address.  Depending 
on where the request originates from, the request will either have a external 
or internal IP address.  External will be redirected to the external site, 
internal will be redirected to the internal site.

Request to www.site.com<http://www.site.com> will be evaluated based on the IP 
address. Then redirected to either 
www.site.com/external<http://www.site.com/external> or 
www.site.com/internal<http://www.site.com/internal>.  I am able to accomplish 
this with the following.

         RewriteCond %{REMOTE_ADDR} ^1.1.1.1
         RewriteRule ^(.*)$ www.site.com/internal<http://www.site.com/internal> 
[R=301,L]


         RewriteCond %{REMOTE_ADDR} ^2.2.2.2
         RewriteRule ^(.*)$ www.site.com/external<http://www.site.com/external> 
[R=301,L]

The problem I am running into is that this is in a loop.  Every request will be 
evaluated and redirected.  If possible, I need a way to redirect once, then let 
other request (www.site.com/external/a/b/c<http://www.site.com/external/a/b/c>  
or www.site.com/internal/x/y/z<http://www.site.com/internal/x/y/z> )not be 
evaluated and then redirected

Any suggestion or help would be greatly appreciated.




<<inline: image001.png>>

<<inline: image002.png>>

<<inline: image003.png>>

<<inline: image004.png>>

Reply via email to