PHP and HTML redirects

If you do not wish to use the .htaccess file to redirect your visitors, use another option – a PHP or an HTML file which will perform the actual redirection. Below are examples for both programming languages:

  • For PHP, create a file (e.g. index.php) in the document root folder of your domain and add the following lines in it:
    <?php
    header( 'location: http://www.yoursite.com/redirect_location' ) ;
    ?>
  • For HTML, create a file (e.g. index.html) with the following content:
    <META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://www.yoursite.com/redirect_location">
    Here you have the option to delay the redirect by increasing the CONTENT variable. For example, CONTENT=5 will delay the redirect for 5 seconds.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.