• 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

Web Design Blogs - BlogCatalog Blog Directory
Minnesota Yellow Pages
Blog Directory
Add blog to our directory.

Find us on Facebook

Follow us on Twitter

Recent Posts

Website Launch: Northland Foundation Supportworks
Reynolds Design Studio is proud to announce the launch of Northland Foundation Supportworks (NFS). NFS is the commercial foundation repair division of American Waterworks out...

View Full Blog »

Contact Us Today

Bookmark Us!