set hostname [ns_info hostname]
If you have ForceHostP set in your parameters/ file, it will try to redirect all requests to this host. This could be your problem if you were messing with virtual servers.