Simple redirect that is not working.... :(
Moderator: General Moderators
-
Rocky70304
- Forum Newbie
- Posts: 5
- Joined: Wed Jul 02, 2008 10:47 pm
Simple redirect that is not working.... :(
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();
?>
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();
?>
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Simple redirect that is not working.... :(
Not sure if this will help, but I think it is supposed to be:
Code: Select all
header("HTTP/1.1 301 Moved Permanently");(#10850)
-
Rocky70304
- Forum Newbie
- Posts: 5
- Joined: Wed Jul 02, 2008 10:47 pm
Re: Simple redirect that is not working.... :(
Tried doing that, tried all kinds of upper and lower case options, but can't seem to get that error to go away. urghhh
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Simple redirect that is not working.... :(
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.... :(
Try:
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.
Code: Select all
<?php
header('Location: http://www.streetlegaltech.com/ltxlsx/', TRUE, 301);
exit;
?>-
Rocky70304
- Forum Newbie
- Posts: 5
- Joined: Wed Jul 02, 2008 10:47 pm
Re: Simple redirect that is not working.... :(
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.
-
Rocky70304
- Forum Newbie
- Posts: 5
- Joined: Wed Jul 02, 2008 10:47 pm
Re: Simple redirect that is not working.... :(
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.
-
Rocky70304
- Forum Newbie
- Posts: 5
- Joined: Wed Jul 02, 2008 10:47 pm
Re: Simple redirect that is not working.... :(
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. 