0

I am trying to redirect all links without www http://exampled.com/products/front/pay.php?course_id=270&student_id=10733

to

http://www.exampled.com/products/front/pay.php?course_id=270&student_id=10733

I used the code below but its giving a blank page if i dont put www

  <?php
 $protocol = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
 if (substr($_SERVER['HTTP_HOST'], 0, 4) !== 'www.') {
header('Location: '.$protocol.'www.'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
exit;
  }
  ?>

0 Answers0