This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: RewriteCond with Custom Http Header
Author
Message |
Programmer27
Newbie


Joined: 30 January 2008
Posts: 10
Posted: 23 November 2011 at 10:07am

Hi, I have a custom http header that is passed in
TEST_HEADER.
I am trying to match it to redirect only certain users.
(The value of the header is the users IP address.)
Problem is, it redirects everyone that comes in with the
'certainParam' in the querystring. Why is it not using
the RewriteCond as a condition?


RewriteCond     %{HTTP:TEST_HEADER}    
^(11\.222\.333\.444)$    
RewriteRule ^/(.*)\&certainParam=T(.*)
/redirectToTestPage   [U,I,R]
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 25 November 2011 at 5:47am

Hello,

Please, try using the following:

Code:
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP:TEST_HEADER} ^11\.222\.333\.444$
RewriteCond %{QUERY_STRING} ^.*&certainParam=T.*$ [NC,L]
RewriteRule ^(.*) /redirectToTestPage [U,NC,R=301]


Regards
Andrew
Back to Top
 
Programmer27
Newbie


Joined: 30 January 2008
Posts: 10
Posted: 27 November 2011 at 10:29am

I made a mistake - I am using version 2 - and this code is not working. can you send me code that will work with version 2?

Thanks!

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 29 November 2011 at 4:08am

Please try it this way:

RewriteCond TEST_HEADER: 11\.222\.333\.444
RewriteRule .*\?.*&certainParam=T.* /redirectToTestPage [I,RP]

__________________
Regards,
Anton
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version