Redirect With Header

Simple question, we have some referral that comes to site and has some data in headers. How can I set them and redirect to another page. So has controller\action something like www.site.com\random that will redirect to another page (by $this->redirect()) and I want that headers where saved in page where we will be redirected.

you can set a header with good old php header function


header('headerName: headerValue');

e.g

header('Location: http://www.google.com');

you can append the data to the url or save it in a cookie/session

What if I want to add all current headers? Can you show code please? So I should get current (all) and add them + redirect.

Yii 1.1 doesn’t manage the currently set headers directly. Instead, you would have to resort to headers_list() to retrieve them.