It's possible that the web server is configured to internally redirect the request based on HTTP request headers that your web browser is sending, but your script isn't. There are several possibilities:
- Your browser is probably using HTTP/1.1, and is thus sending a Host: header.
- Your browser is sending a User-Agent: header. (A likely culprit).
- Your browser is sending an Accept: header. (A less likely culprit).
Try adding these headers to your HTTP request.
Update: The correct answer (HTTP/1.1 + Host:) snuck in while I was typing this.
Update^2: An invaluable reference to have, whether you're using LWP or not, is <a href="http://www.oreilly.com/catalog/webmaster2/"Webmaster in a Nutshell (O'Reilly). It includes a complete overview of HTTP, including request and response headers.