Jump to content

Simple header not working in php..? HELPPPPP..!


kathir
Go to solution Solved by Crew-Portal,

Recommended Posts

Dear Friends, Simple header in php not working. I'm Using XAMPP 1.8.2, PHP 5.4.22.
I dont know this simple header function not working. Please HELPPPP.. :(
I have already tried the following codes.

 

<?php 
header('Location:http://www.google.com'); 

?>

Is there any other problems with php.ini file or something?. Please i need help.

Link to comment
Share on other sites

  • Solution
<?php
header('Location: http://google.com/');
echo "
	<script type=\"text/javascript\">
		<!--
		window.location = \"http://google.com/\"
		//-->
        </script>";
die("Unknown Error");
?>

Make sure this is at the VERY top of your page. Before any HTML gets outputted to the browser. This will try to use PHP for the redirect, if it fails it will attempt Javascript for redirect, if Javascript also fails (or is turned off in the user client) it will cause an error page to load.

Edited by Crew-Portal
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.