Hey everyone,
I have some 301 redirects on my site following a site redesign and just wanted to ask what maybe a stupid question. If i am using the following redirect code:
<?
header( "HTTP/1.1 301 Moved Permanently" );
header( "Status: 301 Moved Permanently" );
header( "Location: newlocation/$user" );
exit(0);
?>
Is there any reason i can't put more php code first to reassign some variables, or does this page need to only have the new headers defined and nothing else? ie can i have this:
<?
if($a==1)
{$user='x';}
else if ($a==2)
{$user=y;}
else
{$user=z;}
header( "HTTP/1.1 301 Moved Permanently" );
header( "Status: 301 Moved Permanently" );
header( "Location: newlocation/$user" );
exit(0);
?>
so as to reassign variable a to user and change the value and then do the relevant redirect? I just wanted to make sure i wouldn't be penalised by google or any other crawlers for some reason, can't see that i would be but i just wanted to make sure?
Thanks very much guys,
Dave