This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Cookie Based redirection
Author
Message |
skunala
Newbie


Joined: 08 October 2010
Posts: 3
Posted: 10 January 2011 at 9:59pm

Hi,
Can you please help me with the rules/conditions required to achieve the following?

1. If a cookie by name "cookie1" does not exists rewrite the url from www.mysite.com to www.mysite.com/defaultHomePage.html

2. If a cookie by name "cookie1" exists then check the value in it and if the value is:
 a. value1 then rewrite the url to url1
 b. value2 then rewrite the url to url2
 c. value3 then rewrite the url to url3
 and so on...

Thanks in advance for the help. I am using IASAPI_Rewrite 2.9.
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 11 January 2011 at 4:55am

That's pretty straightforward:

[ISAPI_Rewrite]
RewriteCond Cookie: value1
RewriteRule url url1 [I,L]

RewriteCond Cookie: value2
RewriteRule url url2 [I,L]

RewriteCond Cookie: value3
RewriteRule url url3 [I,L]

__________________
Regards,
Anton
Back to Top
 
skunala
Newbie


Joined: 08 October 2010
Posts: 3
Posted: 11 January 2011 at 10:09am

Thanks Anton.
How do I check for the non-existence of a cookie? Scenario 1 mentioned above, should try to find a cookie by name "cookie1" and if it does not exist then rewrite the url.

Also, in your response above, where do I mention the cookie name? Will it be like this?

assumung my cookie name is myCookie

[ISAPI_Rewrite]
RewriteCond myCookie: value1
RewriteRule url url1 [I,L]
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 12 January 2011 at 3:19am

Ok, I see what you want. I must be like this:

[ISAPI_Rewrite]
RewriteCond Cookie: (?!cookie1=).*
RewriteRule url url1 [I,L]

__________________
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
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum