Source Rally PHP Community Scripts .. Sign up .. Login
Fast online redirecting with PHP.
Access: Public      Tags: php, header, redirect
Add to favourites       Subscribe comments       Copy code       Bookmark
<?php
//example redirect('http://www.sourcerally.net');
function redirect($location)
{
    
header('location: '.html_entity_decode($location));
    exit;
}
?>
Add to favourites       Subscribe comments       Copy code       Bookmark
Sign up to add your own comment here!

Comments

regin - 30-03-2007 12:02
Add to friends       Mail user
Gonzo: Your solution is not easier from my perspective. And it is much slower, as it will force the user to make another request to get to the desired url.
GoNZo - 29-03-2007 20:51
Add to friends       Mail user
This will be much easier ;)
<meta http-equiv="refresh" content="0; URL=http://www.sourcerally.net">
regin - 14-01-2007 22:23
Add to friends       Mail user
Note: I only use this function and added it here because I got tired of allways writing two lines when it just should be one.
regin - 14-01-2007 22:22
Add to friends       Mail user
Google prefers you to send a 301 moved permanently header :/
By default when you send the location header a 302 redirect is sent as well (http://www.php.net/header).

Read about redirect here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
juglesh - 14-01-2007 03:13
Add to friends       Mail user
How does google like pages getting redirected this way? Is the fact that this redirection is taking place visible to SE's or surfers?
More comments: 1
Shared by:

regin

Mail user Add to friends
All user contributed content is available under the unless specified otherwise.
Remaining copyrights Regin Gaarsmand 2006-2008
About www.SourceRally.net