Redirect page – PHP

Simple :

header(“location=http://www.google.com”);

Apabila muncul error, ex:

Warning: Cannot modify header information – headers already sent by …

gunakan cara alternatif :

1. menggunakan tag meta – refresh

echo “<meta http-equiv=\”refresh\” content=\”0;url=http://www.google.com\”>”;

*bagian yang di bold (tebal), menentukan lamanya/waktu untuk redirect.

2. menggunakan javascript

echo “<script language=\”javascript\”>document.location=\”http://www.google.com\”;</script>”;

Leave a Reply

Your email address will not be published. Required fields are marked *