So much wrong information here, if I were you I'd disregard all the things LastMitch has posted.
1. You can use multiple header() calls.
2. $_SERVER['PATH_INFO'] will not give you the UserAgent, it's to do with the query string.
3. All changing the URL to what LastMitch suggested will do is make the page redirect ho HTTPS
4. There is no reason to use concatenation over a double quoted variable
The problem you are having is caused by some output occuring before the header() function is called, this could be whitespace from files that include this one, an echo, print, etc..