Began to collect unpretentious statistics on the site. I decided to keep track of which page the user is on (at what request he came). For this purpose I use $ _SERVER ['REQUEST_URI']. As a result, I get these options:

/ about or / support - ok, this is expected

http://www.bing.com or www.baidu.com:443 - WTF?

Where do these third-party sites in the request come from?

And how to get the correct address to which the user or the robot passed to me.

1 answer 1

What is $ _SERVER ['REQUEST_URI']?

This is the address that was given in order to access the page from which the request came.

To screen out robots, I would recommend passing some variable through ajax. Most robots do not launch javascript on the site. You can generate a user token on the PHP side (after collecting the necessary information about the user from the $ _SERVER ['...'] array) and then run a script that in the background sends to the server that "there is no robot on the site".