Problems with PHP Header Redirect
Recently I was writing a PHP script which required a bit of code to redirect a user from the current page to another one. This is achieved using the following code:
Unfortunately, however, I could not get this to work for me. I tried every suggestion and tip I could find on the web to no avail. Many sites advised making sure to remove any “white space” in the PHP file. I removed every single bit except the 3 lines listed above, deleted the fourth blank line by going to the end of the third and hitting delete. No joy.
I got in contact with my fantastic web hosting company Webhost.ie and they figured it out. By default PHP on their servers runs at PHP4. As soon as the version running was changed to PHP5 in the website settings area the script ran perfectly!
So there you go: if you’re having trouble with PHP header redirects check the PHP version number running on your web server. You might need to update it to version 5. Also, if you need reliable web-hosting with fantastic support I highly recommend you check out www.webhost.ie. I’m not in any way related to their business, just a happy customer.