Page 1 of 1

Simple redirect that is not working.... :(

Posted: Wed Jul 02, 2008 10:55 pm
by Rocky70304
I am new to PHP code (just starting a website), however I have wrote generic object oriented code before which is similar. I wrote a simple redirect code to redirect my main site http://www.StreetLegalTech.com to a sub directory http://www.StreetLegalTech.com/LTXLSX , I have to have this redirect until I get my main page up and running (which will be awhile) anyways my code is pasted below, but when i pull the page up it gives me the following error :
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in D:\Hosting\3074294\html\default.php on line 2

Parse error: syntax error, unexpected T_STRING in D:\Hosting\3074294\html\default.php on line 2
I have thought about this for hours and can't come up with any thing wrong with this code, if anyone can help I would greatly appreciate it.
Thanks,

Code saved as default.php, also have tried saving it as index.php:

<?php
header("http/1.1 301 Moved Permanently");
header("location: http://www.streetlegaltech.com/ltxlsx/");
exit();
?>

Re: Simple redirect that is not working.... :(

Posted: Thu Jul 03, 2008 12:47 am
by Christopher
Not sure if this will help, but I think it is supposed to be:

Code: Select all

header("HTTP/1.1 301 Moved Permanently");

Re: Simple redirect that is not working.... :(

Posted: Thu Jul 03, 2008 10:28 pm
by Rocky70304
Tried doing that, tried all kinds of upper and lower case options, but can't seem to get that error to go away. urghhh

Re: Simple redirect that is not working.... :(

Posted: Fri Jul 04, 2008 3:28 am
by John Cartwright
Theres no parse error in that code, thats for sure. Are you sure you are updating the correct file?

Re: Simple redirect that is not working.... :(

Posted: Fri Jul 04, 2008 4:29 am
by Bon Bon
Try:

Code: Select all

<?php
header('Location: http://www.streetlegaltech.com/ltxlsx/', TRUE, 301);
exit;
?>
Copy and paste the full lot into your PHP page overwriting everything you posted in your initial post. If you have anything before it please post that so we can work out if anything else is causing a problem.

Re: Simple redirect that is not working.... :(

Posted: Fri Jul 04, 2008 11:39 am
by Rocky70304
Tried that code, gave me the same error. To be on the safe side, I completely deleted the file from my server and re-ftp'd the file with the new code, same error. That is the only code in the whole file, just the simple redirect, it's not making any sense to me.

Re: Simple redirect that is not working.... :(

Posted: Fri Jul 04, 2008 11:41 am
by Rocky70304
FYI, my server's PHP version is 5.x, don't know if that has anything to do with it, but just want to make sure that is out there.

Re: Simple redirect that is not working.... :(

Posted: Sun Jul 06, 2008 7:18 pm
by Rocky70304
Solved the problem, just thought I would post this in case others run accross this. I tried uploading the file with godaddy.com's file manager, i tried using an ftp client, and also made a network connection to ftp the file, all gave this error. However, tonight I wrote the redirect in a blank file using godaddy's file manager and saved it there and it works great now. Don't have a clue why that makes a difference, but apparently it does. :)