How to Redirect PHP Object Context

The PHP redirect object context lets you redirect a Web page to another page using a 301 redirect response. The 301 redirect response is a "permanent" redirect. This response tells browsers and search engines that you want to permanently redirect the content to a new Web page. If a user opens the old, redirected page, the browser automatically forwards the user to the new page object.

Instructions

    • 1

      Right-click the PHP page you want to redirect and select "Open With." Click your PHP editor in the list of programs.

    • 2

      Add the object context header. Add the following code to the top of the file:

      header("Location: /newpage.php",TRUE,301);

      The response permanently redirects to the "newpage.php" file on the server. Replace "newpage.php" with the actual page to which you want to redirect your readers.

    • 3

      Save the changes and upload the page to your Web host provider. Open a Web browser and navigate to the page you just uploaded. Notice that the page automatically redirects to the new page you set up in the header function in Step 2.

Related Searches:

References

Comments

Related Ads

Featured