Archive

Posts Tagged ‘redirect’

Using Proper Header Redirects In PHP

July 30th, 2008

Let’s say you have an old web-page that’s no longer in use. Of course, you’ll want to redirect your users to the correct (new) page. Using PHP, you can modify the headers of a web-page to redirect them to the correct page.

< ?php
header("Location: http://www.mydomain.com/newpage.html");
exit();
?>

This will cause the user who visits the web page with this code, to be redirected to http://www.mydomain.com/newpage.html (or any other page you specify).

That’s all fine, and works well. But what if Google indexed your old web page, and still directs traffic to it? What if search-results in Google only display the old page, instead of the new one? What if, one day, you decide to take the old page offline? Read more…

Matti PHP, Seo , , ,