Welcome to WebmasterWorld Guest from 18.104.22.168
1st is using the popular meta refresh tag.
2nd is using the header() function in PHP.
Although they both redirect page, I actually want to know how they are different with each other. I mean how do both of them redirect pages (technically).
header("location...") is server side and depends upon the PHP script calling it before it will send the new page to the client.
The Location HTTP header field contains the location where the UA will find a certain resource. The exact meaning depends on the HTTP status code and/or context of other header fields. The UA will need to request the new resource.
Both methods originate at the server. Both methods tell the UA that it should do something locally, i.e. request a certain resource.
So my worries is now confimed. My refresh, are used to redirect affliate link. (AL) An AL is actually another redirect too! So, my 1st page redirect it to the AL and the AL will redirect to the advertiser. The important role of the AL is to track the # of click and MOST important, plant a cookie to the visitor computer!
So if header is server side, does it means the cookie will not be planted in the visitor computer. And most likely is planted in the server computer?! :)
So my conclusion is - it is safer to use meta refresh to redirect AL. Please advice.
So if header is server side, does it means the cookie will not be planted in the visitor computer. And most likely is planted in the server computer?!
No. The server issues the http header and sends the http message to the client. The client then requests the new page.
The communication is always between client and server. The client requests a page the server answers: the resource is not here. Look at this URI and please store this cookie. It is then up to the client to decide whether he wants to request the resource from the new URI and store the cookie. If it decides to follow the serverīs advice, it will then request the resource from the other server which may either send back the resource in an http message with a 200 OK status, redirect the client again or do a lot of other things.
Always remember that with a Location or Refresh header one server does not redirect the client directly to another server. It just lets the client know where to look any further.