Tuesday 5 July 2011

PHP Redirect Script: Easy script, take less than one minute to install


Redirecting the user from one page they enter in the address bar of their browser to another page of your choice in php script is a simple and easy way. just a one line code and its done. For example:


Your website url is www.your-web-site.com


and your web pages and all the website stuff in on page www.your-web-site.com/new


and you want your user to enter the first one .com address and redirected to the .com/new address.


using the above example, here is the code for redirect in php:



<?php


   header( 'Location: http://www.your-web-site.com/new/index.html' ) ;


?>


Its is a simple code but just one thing to remember, never use any tags or text before this code.e.g entering a <html> tag before this code.

0 comments:

Post a Comment