I have a PHP script call notfound.php
that get executed when my web site hits a 404, and it will try to create a valid URL based on some logic that I have written.
After I create a new URL I check if thats a valid URL or not.To do that I have tried get_headers
, CURL
, and file_get_contents
.
But only file_get_contents
always return a valid answer.
The problem I'm facing right now is if the new URL is also a 404, file_get_contents
is again go in to my notfound.php
, and take ages to say new URL is also a 404. I think its going on a loop or something.
Then I tried to send the $context
to file_get_contents
saying follow_location = 0
, didnt work either.
I spend my whole day looking for answers but failed :(, any one got any ideas?