Tuesday, December 9, 2008

Apache rewrite with cookie value set

Using Apache redirect rule, you can redirect a specific request to another url setting cookie value. (Apache rewrite with cookie)
This will redirect any specific request and sets client cookie with defined values. (Apache rewrite with cookie)

For Example:
RewriteRule ^/abc/ff/(.+) http://www.somedomain.com/abc.php?code=$1 (Apache rewrite with cookie) [CO=DemoCookie:$1:.somedomain.com:100:/]

This will redirect
http://www.somedomain.com/abc/ff/123

to

http://www.somedomain.com/abc.php?code=123

and set cookie at client browser with name DemoCookie , value 123, domain somedomain.com and time set 100. (Apache rewrite with cookie)

No comments: