Bankzilla
Bankzilla

Reputation: 2096

Header redirect taking a long time

I have two servers running the exact code, while the staging server works like a charm the production server is extremely slow when it comes to redirecting.

  1. Working Link
  2. Link with long response delay

I've searched through google and used a few of there alternatives but nothing seems to do the trick.

Current method

if (strpos($headers[$index], 'Location: ') === 0) {
        $redirection = $headers[$index];
        break;
    }
header($redirection);
exit;

Have tried the following

header($redirection);
echo "<HTML></HTML>";
exit;

this below method breaks it

if ($headers[$index]){
        $redirection = $headers[$index];
        break;
}
echo '<META HTTP-EQUIV="Refresh" Content="0; URL='.$redirection.'">';
exit;

Redirect is https://www.youtube.com/watch?v=YVB1r4D8QH0?version=3

Upvotes: 1

Views: 1660

Answers (1)

ldrrp
ldrrp

Reputation: 704

try adding a output buffer at the top, dont echo anything else after it then just exit

ob_start();

Upvotes: 1

Related Questions