Question by  crazycool (145)

How do I redirect a web page in php5?


Answer by  tjh1234 (362)

You need to use the 'header' command: header('Location: URL to redirect to'); in your PHP script. Note that it must be sent before any actual output is sent from your script (such as HTML) otherwise it won't work.


Answer by  rover (53)

You use the header function, and send a location header. The code looks like this: header('Location:http://sitetogoto. com'); Make sure you put this function call before any print or echo statements in your code, or use output buffering.


Answer by  Clemens (29)

On the redirtecting page, remove all your code and put this : ! attention! Do not put HTML tags before it, it will not work if so!


Answer by  smiles (44)

To redirect a page in php5, you would use the header function. The header function takes the parameter "Location: " and a string variable representing the URL in which the user should be redirected. The URL can be a string or a variable. For example, header("Location: http://www. yahoo. com") or $URL = "http://www. yahoo. com"; header("Location: $URL);


Answer by  PowerIsMe (844)

header ("Location: website. address. here"); Include that after your php start tag and make sure that is the first thing in the file. Insert your redirect website address in the website. address. here location.


Answer by  japratt (1687)

If you are wanting to redirect this type of page then you will need to save the file as something different.

You have 50 words left!