Is it possible to set a cookie in the response only if there is a Location header?

I couldn't find a way to set a cookie except for using Header or with mod_rewrite but I think it is only useful for modifying the request.

How do I set Header only if there is a response Location header?

I couldn't find a way using Header and Set-Cookie. I can't use set because it'll overwrite other cookies. I can't use edit because the Set-Cookie won't always exists. I can use append because it might create two cookies with the same name and different values instead of one.

Thanks

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.