Jump to content

Coding error


AlchemI

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/236478-coding-error/
Share on other sites

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215755
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215759
Share on other sites

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']);

 

 

Link to comment
https://forums.phpfreaks.com/topic/236478-coding-error/#findComment-1215901
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.