PHP is open source scripting language. It\'s widely used to develop web applications.  Home Web Programming PHP Auto Redirect

Auto Redirect


Auto RedirectNote 1: You don't have to know PHP programming to do this tutorial. Note 2: I assume that your server supports files with .php extension. If not, you won't be able to do this tutorial. For more info on how to install PHP on your PC go to Php.net

1. Open notepad or any other HTML Editor and paste the following code.

<?
$URL="http://www.adesdesign.net";
header ("Location: $URL");
?>
<html>
<title>Ades Design</title>
<head></head>
<body>
</body>
</html>

2. Save as ades.php and upload to your web server. Now access it through your browser at http://www.yourdomain.com/ades.php You should be automatically redirected to my website.

3. Now customize your script. Put your own link instead of Adesdesign.net and change the title Ades Design.

You can also put some text or link inside the body. In case your redirection does not work people will be able to click and go to the desired page.



Author's URL: Ades Tynyshov
PHP is open source scripting language. It\'s widely used to develop web applications. More PHP Tutorials: Featured Materials | Fresh Materials | More PHP Tutorials at LearnPHP.org

Reader's comments
comments Ty September 26, 2011 says:
Go to,

www netbulge com

Then select "PHP: Redirect pages" half way down the web page on the right hand side.

Reply
comments Ty September 26, 2011 says:
Your comment system is useless!

""

Reply
comments Ty September 26, 2011 says:
Sorry this code will not reproduce in this type of comment structure.

Go to,

Reply
comments Ty September 26, 2011 says:
"<script>document.location.href='>"
Reply
comments Ty September 26, 2011 says:
The answer is,

<script>document.location.href='>

Reply
comments Ty September 26, 2011 says:
But how do you write a short script to redirect to the php file automatically when the main web page loads?

Velly interesting,

Ty

Reply
comments Animefan June 20, 2011 says:
Thanks man it worked

animefan.nl ~

Reply
comments Name March 26, 2011 says:
not bad
Reply
comments billyb October 07, 2010 says:
how does it work
Reply
comments David Smith February 17, 2010 says:
Why define the variable $URL?

<?
$URL="";
header ("Location: $URL");
?>

Can just be

<?
header ("Location: ");
?>

Reply
comments itsols August 28, 2007 says:
Short and sweet - Just the way I need it.

Thanks - Great job; Well done.

Khalid

Reply
Add comments to "Auto Redirect"

Captcha