Just changed the header code to be a relative url and it worked in the 'blank' script. I put that same bit of code into the original index.php file and I get the redirect error again.
Here is the entire script - just in case I'm missing something later on in the code
<?php
$url = getenv(HTTP_HOST);
if ( stristr( $url, "lee.maidstoorder.com" ) ) {
header( "Location:/index.php?site=lee" );
exit;
}
// check to see if we should display a popup poll
if ( !defined( 'SMARTY_DIR' ) )
include_once( 'config.php' );
// get a list of all active polls
$page_id = intval( $_GET['page_id'] );
$form_id = intval( $_GET['form_id'] );
displayPolls();
// if no page or form is specified, then get the default page or form
if ( !$page_id && !$form_id ) {
// update the site counter
$siteInfo = $db->getRow( 'select * from ' . SITES_TABLE . " where site_key = '$site'" );
$siteCounter = 1 + $siteInfo[counter];
$db->query( 'update ' . SITES_TABLE . " set counter = '$siteCounter' where site_key = '$site' limit 1" );
if ( $siteInfo[default_resource_type] == 'page' ) {
$page_id = $siteInfo[default_resource_id];
}
else if ( $siteInfo[default_resource_type] == 'form' ) {
header( 'Location:getForm.php?' . 'form_id=' . $siteInfo[default_resource_id] );
exit;
}
else if ( $siteInfo[default_resource_type] == 'module' ) {
// get the name of the desired module
$moduleName = $db->getOne( 'select module_key from ' . MODULES_TABLE . " where id = '$siteInfo[default_resource_id]'" );
// presumes that the directory that the module is installed in = the module name
header( 'Location:' . MODULES_DIR . '/' . $moduleName . '/index.php' );
exit;
}
else {
$page_id = $db->getOne( 'select min(id) from ' . PAGES_TABLE . " where site_key = '$site'" );
}
}
// get the page name for the <title> tag
$pageInfo = $db->getRow( 'select title, skin_id, counter from ' . PAGES_TABLE . " where id = '$page_id' and site_key = '$site'" );
$t->assign( 'title', $pageInfo[title] );
// load the skin for this page, if a skin has been associated with it
// if we're previewing a skin, then use the $_GET['preview_skin'] value instead
if ( $pageInfo[skin_id] ) {
// 'settings' is the current settings that we have assigned to the template
// the skin loader may override those settings, and re-assign to the template, $t
// set image caching to ensure that we use the correct skin images
// $c is a class Cacher object which is set in init.php
$c->_skin = $pageInfo[skin_id];
$skin->load( $pageInfo[skin_id], $t->get_template_vars( 'settings' ), $t, SETTINGS_TABLE );
// load this skin's style settings
$skin->load( $pageInfo[skin_id], $t->get_template_vars( 'cssStyles' ), $t, STYLES_TABLE );
$stylesArray = $t->get_template_vars( 'cssStyles' );
}
$data = $db->getAll( "select * from " . SECTIONS_TABLE . " where page_id = '$page_id' and site_key = '$site' order by _order" );
// massage the data a bit to account for bulleted lists, etc.
$data = applyFormat( $data );
// update the counter for this page
$newCount = $pageInfo[counter] + 1;
$db->query( 'update ' . PAGES_TABLE . " set counter = '$newCount' where id = '$page_id' and site_key = '$site'" );
// fetch all data for this page
$t->assign( 'data', $data );
// if this page is the logout page, then also terminate the session
// HOWEVER: do not logout if we are simply previewing a skin!!
$inTepmplate = isInTemplate( 'page', $page_id );
if ( $page_id == $siteData[logout_page_id] ) {
$s->end( $_REQUEST['PHPSESSID'] );
}
if ( $poll ) {
$t->display( 'popupHeader.tpl' );
$t->display( 'pages/index.tpl' );
$t->display( 'popupFooter.tpl' );
}
else {
$t->assign( 'bodyTemplate', 'pages/index.tpl' );
$t->display( $templateName );
}
$db->disconnect();
?>