To help keep things simple, please permit the "assumption" that some code requires using a full URL, despite the fact that the domain is on a single server, i.e. an easy file path can't be used.

TCP/IP?? Question: If your form action target = "" (for instance) and that URL can also be on a single server, then which happens first?

A) Information is sent "out to the web", after which returns towards the same server, or

B) Before delivering any (possibly sensitive) data, the server (Linux, Apache, PHP), first "finds out" the prospective address is local, so (clearly) no information is sent within the internet? Thanks.

The right response is always A. :-)

It simply happens the situation in which the browser and also the server are running on a single machine, "the netInch is going to be short-circuited through the local TCP/IP stack. However, Apache and PHP aren't involved for the reason that decision it's pure functionality from the OS networking stack.

However, in case your server is behind a NAT gateway or firewall and also the DNS title is solving towards the NAT gateway/firewall, the request is going to be routed towards the NAT gateway/firewall and to your machine. Thus, to ensure that the routing to remain on exactly the same machine, the DNS title from the host from the target URL needs to resolve towards the actual Ip from the server machine, 't be tunneled into it.

The network software will resolve the hostname for you machine, then your local TCP stack will route the request in your area. Traffic will not ever leave the device, it'll be in memory around the server.