I was working on a PHP code, and had header('Location: '.$location, TRUE, 200);, it did not redirect to $location (Value here was “https://thepiratebay.se/” ). I have listed all the headers present, Please help.
As you can see that the Location header was present but didn’t redirect to. Why?
Browsers tested: Chrome, Firefox, IE, Safari.
Headers were (As shown by Chrome):
HTTP/1.1 200 OK
Date: Sat, 25 Aug 2012 15:10:54 GMT
Server: Apache/2.4.2 (Win32) PHP/5.4.4
X-Powered-By: PHP/5.4.4
Location: https://thepiratebay.se/
Content-Length: 5935
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
Your mistake is the
200response code.Change this line:
To be
Where
$codeis either 301 or 302 (Moved permanently vs Moved temporarily).