Dave Tips

Tips for computers and the internet. How to, tips, tricks and resources for computers and the web.

Saturday, August 29, 2009

Redirecting Web Pages Using PHP

You can redirect the root level of your site http://www.example.com/ to a lower level webpage like http://www.example.com/directory1/directory2/filename.html ) in many ways.

One way to make such a redirection, if you have a Linux hosting plan with GoDaddy, is to make a text file named "index.php" and have the file contain:

 <?php
//Redirect browser
header("Location: http://www.example.com/directory1/directory2/filename.html");
?>
 

Place it in the root of the "web/" directory in your hosting space and, barring a lot of complex configuration changes that may have been made previously, it should gentle redirect web visitors from http://www.example.com/ to http://www.example.com/directory1/directory2/filename.html .

Labels: , ,