Redirect your Traffic With PHP

In this tutorial we will make a php code that helps to redirect traffic for different purposes.
redirect

Redirect your visitor to where the page is moved is a must to prevent losing traffic and sale, you can do that whith PHP, find the necessary code from below that suits your need and use it.
when you are haveing a Maintenance its important to let the users know that you are under going Maintenance.

1.Redirect For Temporary Maintenance Or For a short Time

If are just modifying or changing a single page or a few pages of the web site you need not redirect all the visitors.You can use a PHP redirect or a html redirect to redirect them.
IF you want to permanently redirect the visit to a page you can use this
If you use a PHP server use this or if you use a HTML use the code given below the PHP code



				

Change the code on the redirect page to be simply this. You need to replace the URL above with the URL you wish to direct to.
Be sure that you do not have any text sent to the browser before this, or it will not work. Your safest bet is to simply remove all content from the page but the redirect code.



   //this will NOT work, the browser received the HTML tag before the script
   header( 'Location: http://www.yoursite.com/new_page.html' ) ;

				


The Hyper Text Way



				

Copy the following on to the page on which you want to redirect and change

with required file name.


2.Redirect after a short Time

If you want to convey some message to your visitors and then redirect them the you can is this code.
This can be helpful some times since your users can know why they got redirected.


);
   header( 'Location: http://www.yoursite.com/new_page.html' ) ;
?>
				

replace the



replace the