Is there a way for a “normal” webpage (ie. Javascript or PHP) to detect how it was called?
For example… If someone types in “www.rdS.com”… the browser will load “www.rdS.com/index.php”
or if they type in “xxx.xxx.xxx.xxx/index.php” (where xxx is my IP address)… they get the same result…
But can index.php tell which method was used to call it? and for example … redirect if it were called by IP address instead of URL?
The way that web servers and PHP pages, etc detect what host you are trying to reach is by the “host” header sent in the request. Without that, it is not possible to tell, because the browser resolves the name to the IP address before making the request. The host header is what enables virtual hosts (more than one host on a single IP address) to function at all. That is why sometimes putting the IP address in the browser does not work.
… to answer the other part of your question: yes, reading the “host” header sent with the request, the web server or page could redirect based on that value… again, that is exactly how virtual hosts work.
I hope that makes sense, I have taken a ton of allergy medication today %)
This is called Referer and should ne found in Server Variables as John said but…
Privacy aware Websites hides their Referers so the next Website won’t know from where somebody is coming
The referrer is different from the Host header. The referrer represents the source of a link that leads to the request. Like if you click a link on google to your website - the referrer would be google, the host would be your website.
In xojo, it may be possible to read the header here WebApplication.HTMLHeader but I am not totally sure. Anyone else want to comment on that? How do you read the request headers sent to a xojo web application?