Page Redirect

I totally forgot how to redirect to another page using PHP. After trying to remember I had to look it up in the PHP documentation. So if you want to redirect to another page using PHP you write to the header using this bit of code:

header('Location: index.html');

I opted to use PHP solution instead of the HTML meta refresh tag. You can do the same thing by placing this tag in your html output.

<meta
  http-equiv='refresh'
  content='0;URL=http://www.juixe.com'>

Of course, you can redirect to another page in just about in every language, including JavaScript as this snippet of JavaScript code demonstrates it:

document.location.href='index.html'
Enjoy. Share. Be Happy.
  • Twitter
  • Facebook
  • StumbleUpon
  • del.icio.us
  • Tumblr
  • Google Bookmarks
  • FriendFeed
  • Yahoo! Buzz
  • Reddit
  • Digg
  • HackerNews
  • Suggest to Techmeme via Twitter
  • LinkedIn
  • Ping.fm
  • Identi.ca
  • Mixx
  • Furl

Related posts:

  1. Search Engine Optimization
  2. TechKnow Year In Review 2005
  3. Markup for the Semantic Web
  4. HTML FieldSet Tag
  5. Google Web Toolkit Tutorial: The Break Down

This entry was posted in HTML/XML, JavaScript, PHP, TechKnow. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*