AlchemI Posted May 15, 2011 Share Posted May 15, 2011 Hi can anyone please tell me what is wrong with this code? It is an index.php file. I think I might have accidentally deleted something somewhere between line 12 & 13? Please help my whole website is down because of it. I am not a programmer and I was trying to do a 301 redirect. It didn't work obviously, so I removed the script that I entered and saved the file again, but it is still not working. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/ Share on other sites More sharing options...
Insecure Posted May 15, 2011 Share Posted May 15, 2011 Did you do any updates to this? Something with SEO?? // ################# Start recognize SEO Url data ############################# Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215747 Share on other sites More sharing options...
AlchemI Posted May 15, 2011 Author Share Posted May 15, 2011 No. Not unless I've accidently removed some of the script. I don't think I did though. All I did to my knowledge was put this script in at line 13: <?php if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.'.$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']); } ?> And when it screwed up my website I removed it, but it didn't fix it. Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215755 Share on other sites More sharing options...
Insecure Posted May 15, 2011 Share Posted May 15, 2011 What error are you getting? Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215756 Share on other sites More sharing options...
AlchemI Posted May 15, 2011 Author Share Posted May 15, 2011 When I go to www.dogtrainingvids.com I don't get an error message at all, just a blank page. When I go to www.dogtrainingvids.com/admin I get this: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mike79/public_html/config/config.php on line 82 Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215759 Share on other sites More sharing options...
TheSky Posted May 15, 2011 Share Posted May 15, 2011 line 82 Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215762 Share on other sites More sharing options...
AlchemI Posted May 15, 2011 Author Share Posted May 15, 2011 Yeah but thats referring to config.php not index.php. I haven't touched config Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215763 Share on other sites More sharing options...
AlchemI Posted May 15, 2011 Author Share Posted May 15, 2011 Here is what it says at line 82 in config.php: if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.'.$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']); } ?>"; Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215766 Share on other sites More sharing options...
AlchemI Posted May 15, 2011 Author Share Posted May 15, 2011 Could it be that the script I entered in index.php created that script at line 82 in config.php? Do I have to remove that bit of script as well? Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215769 Share on other sites More sharing options...
Insecure Posted May 15, 2011 Share Posted May 15, 2011 if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.'.$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']); } ?>"; Why is your last line ?> and then "; Try removing the ?> ?? Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215808 Share on other sites More sharing options...
AlchemI Posted May 16, 2011 Author Share Posted May 16, 2011 Nah the whole section in context is: ### Tracking Code ### $config["header_code"] = "<?php if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.'.$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']); } ?>"; $config["footer_code"] = "<script type=\"text/javascript\"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-23365214-1']); _gaq.push(['_trackPageview']); Quote Link to comment https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215901 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.