PHP forwarding

This tutorial will explain how you can forward a web page to other URL using PHP forwarding.
It will be useful when you do not want to use other way of forwarding, like .htaccess permanent redirect, META redirect, Java redirect, etc.
This type of forwarding can be used only on a server with running PHP on it.

To do the forwarding create one ”index.php” file and paste the bellow listed code inside and do not forget to change ”http://www.domain.tld/folder/index.html” with the URL you want to forward to.

Tags

Filed Under: Web forwarding

Anthony Gee About the Author: Anthony G. is an IT specialist with more than 9 years of solid working experience in the Web Hosting industry. Currently works as server support administrator, involved in consultative discussions about Web Hosting and server administration. One of the first writers in the Onlinehowto.net website, now writing for Free Tutorials community - he is publishing tutorials and articles for the wide public, as well as specific technical solutions.

Comments (2)

  1. spase says:

    ok, but how I can do permanent redirect with php?

  2. tony says:

    This one should work:
    < ?php header( "HTTP/1.1 301 Moved Permanently"); header("Status: 301 Moved Permanently"); header( "Location: http://www.domain.tld/"); exit(0); ?>

    But better use .htaccess or any redirect on server level as it is better for the SE

Leave a Reply