What is PHP Redirect?

Article Details
  • Written By: R. Kayne
  • Edited By: O. Wallace
  • Last Modified Date: 22 October 2019
  • Copyright Protected:
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
In 2008, Mike Merrill became the first publicly traded person, allowing shareholders to control his life decisions.  more...

October 23 ,  1983 :  Suicide bombers killed nearly 300 US and French military troops in Beirut.  more...

A PHP redirect is a small bit of code embedded in a webpage that takes the surfer to a new webpage automatically. PHP once stood for Personal Home Page, though the term “PHP” is now used independent of that original meaning. The code was created in 1994 by Rasmus Lerdoff for his personal use, then released as PHP public code in 1995, with current implementations by The PHP Group. It is a standardized free scripting language.

A PHP redirect can be handy for webmasters that want visitors to bypass a defunct webpage and enter a new page at a different location or website address. Established search engine links along with links from other websites will continue to direct traffic to a defunct site long after a page has been taken down or the address has changed. Rather than lose that traffic, the webmaster can keep the old page posted to the Web server with just the PHP redirect code. This forwards visitors to the new page or site without making them click an additional link.

A PHP redirect can be employed a number of ways. While it is recommended all extraneous content or code on the page be removed, one can include a message to the surfer that the address of the page being sought has changed. The message also typically states that the surfer is being redirected, and suggests that bookmarks be updated to reflect the new address.


In the simplest form, PHP redirects the visitor seamlessly. Unless the surfer notices the uniform resource locator (URL) field in the Web browser, the new location will go unnoticed all together. This might not be the best choice if you want the new page bookmarked. A PHP redirect is not meant to be used indefinitely.

Unfortunately, redirects can also be used in phishing schemes or to siphon traffic from legitimate sites. In the latter case people are redirected from "decoy links" posing as legitimate sites. Traffic is redirected to offensive sites where mousetrapping is employed to get click revenue from surfers trying to click their way out. This misuse of redirects is called pagejacking.

Some browsers or their add-ons will protect surfers against being redirected. With this type of protection enabled the surfer might not be permitted to be redirected, or might be warned and asked to click a button to allow it.

Despite abuse by unscrupulous persons, PHP redirect code is handy to have on hand for nearly any webmaster. The code is freely available on many webpages, along with suggestions on how to implement it. If your Web host does not support PHP scripting, HTTP and JavaScript redirects are also widely published.


You might also Like


Discuss this Article

Post your comments

Post Anonymously


forgot password?