The Referer HTTP header is usually used for this purpose. This Stack Overflow question deals with fetching that Header from a PHP file:
How do you get the 'referer' header in PHP?
The trick may be making sure that the header is included in the redirect from your html page to your php page. There is another Stack Overflow discussion about this:
Will a 302 redirect maintain the referer string?
In general, if you have control over the index.html page and the server that hosts it, you should be able to find a way to accomplish what you are trying either programatically or via server configuration.