Blog

How to Redirect Using PHP

Posted on in Uncategorized

1083328_41541641A redirect is quick and easy with PHP. When you want to redirect a user from the page they entered to a different page, all you need to do is use a simple PHP script. Simple PHP redirects are useful for instances where the page the users are trying to access no longer exist.

With this simple method, you can seamlessly redirect users to the new page without requiring to click on a link in order to proceed. Redirects using PHP work on all browsers, so they’re an ideal solution for web development.

Here’s how a simple redirect should look:

<?php

header( ‘Location: http://www.examplesite.com/new_page.html’ ) ;

?>

First, change the code on the redirect page following the above example. Then, replace the URL in the example with the URL you want your page to redirect to. Make sure there is no text sent to the browser before the redirect or it will not work. Finally, you may want to remind users to update their links or bookmarks.

What our clients are saying

I want to thank you for your help with our website development project. Your programming skills, attention to detail, and ability to interact directly with our client were excellent. You have provided tremendous value to my organization. With a project of this magnitude, including the use of web services to push data out to 19 sub-websites, your ability to overcome our unique challenges and coordinate with my IT team was exceptional. I appreciate your help, and I am certain that your expertise was key to the project's success. Thanks again, I look forward to working with you on our next endeavor!

~ John Forgione – Executive Vice President – SFA Marketing, Inc.

Read More