Redirect your Visitors

Redirect your Visitors


Redirect your Traffic With PHP

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

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:' ) ;


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:' ) ;

replace the

replace the


Wow ! you have someting to tell us. That's great! Please keep in mind that comments are moderated, we employ rel="nofollow" for links, avoid using a spammy word or a domain in name field, it might end up as a Spam. Thanks for reading.

Last 5 Articles

All Articles >

  1. Ten Tips for Effective Work in Web Design

  2. Security Myths

  3. Model Design for Orders in Django

  4. Automating Business Operations

  5. Unit Testing in Python using assertAlmostEqual


News Letter

Subscribe to our email newsletter for useful tips and valuable resources, sent out every new article release.