04May2011
Author
Dave
Category
PHP
Tags
,
PHP Redirect Thumbnail

PHP Redirect

Tutorial on PHP redirect to be redirected to another page or web site

Tutorial on PHP redirect to be redirected to another page or web site

For this tutorial lets suppose you have moved your web site to another domain and want your visitors to be redirected to your new domain you can use PHP for this purpose.

Here is the code to redirect a user:

<?php>
header ('Location: 'http://www.daveismyname.co.uk');
?>

Here’s a breakdown of the code.

The <?php tells the browser to expect to receive php.

header (‘Location: ‘http://www.daveismyname.co.uk’); tells the browser to redirect to the address given in the code and ?> tells the browser to finish expecting PHP.

Author
Dave

About the Author

has written 72 articles on Dave is my name.

My name is David Carr I'm a PHP web developer based in Hull it is my passion to design and develop clean, accessible and usable websites using PHP and other web technologies, I'm an avid Twitter user why not follow me? https://twitter.com/daveismynamecom

Visit this author's website   ·   View more posts by

Sharing is caring.
  • Subscribe to our feed
  • Share this post on Delicious
  • StumbleUpon this post
  • Share this post on Digg
  • Tweet about this post
  • Share this post on Mixx
  • Share this post on Technorati
  • Share this post on Facebook
  • Share this post on NewsVine
  • Share this post on Reddit
  • Share this post on Google
  • Share this post on LinkedIn

Discussion

No responses to "PHP Redirect"

There are no comments yet, add one below.

Leave a Comment