Thanks for your help guys, I've fixed the problem now. I'd applied some changes to this file to redirect http to https, and had commented out a couple of lines of the original code. Stupidly I'd used the wrong character for comments (#).