Aug
25
2008

How-To – Redirect 404 to index page via PHP

I’ve been working a quirky sub-domain 404 issue and I found a quick and clean redirect script. Instead of a nasty 404 page you can redirect the web request to the index page. I found the helpful script here: http://css-tricks.com/how-to-redirect-indexhtml-to-indexphp/

I deleted whatever text was in 404.php and replaced it with:


header( 'Location: http://www.redirect-location.com' );
exit();
?>

Worked like a charm for me!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • LinkedIn
  • Live
  • StumbleUpon
  • Technorati
  • TwitThis
  • Yahoo! Buzz
Written by Tom Tags: ,

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes