• Web Design and Development Blog - Rochester MN

  • blog » home

Redirecting an HTML Page in PHP

March 22nd, 2008 · No Comments

If your new to PHP and looking for an easy way to send your user to another page try using the php function header(). You shouldn’t use this function if you are trying to redirect a site or page for SEO (search engine optimization) reasons because Google and the other engines won’t give you credit for the redirect.

I use the header redirect function after parsing an html form, or log-in script has been run. If you are going to use this with other html content the function will not work if you have printed ANYTHING to the screen. You should do something like the following:

<?
# this will redirect you page to google.com
header(
Location: http://www.google.com”);
?>

<html>
<head>
</head>
<body>…

If you put the <? ?> code under the <html> tag the function will not work as you have printed something to the screen. Just some food for thought.

~RDS

Tags: Coding · Servers · Web Development

0 responses so far ↓

  • There are no comments yet. Begin by filling out the form below.

Leave a Comment

Web Design Blogs - BlogCatalog Blog Directory
Minnesota Yellow Pages

Find us on Facebook

Follow us on Twitter

Recent Posts

Site Launch: Heartman Insurance
We are proud to announce the launch of Heartman Insurance, a full service independent insurance agency headquartered in Rochester, MN. We worked closely with the Heartman staff...

View Full Blog »

Contact Us Today

Bookmark Us!