A php script is executed on the page.
Page url like: site.com/razdel/index.html
The script is in the root, in a separate folder.
Hints like $ _SERVER ['REQUEST_URI']
lead to a script file
“/sendmail/sendmail.php”
How to in php get the html page URL?
Any manipulation of files, their location and structure is rejected.
Answer 1, authority 100%
echo 'http: //'.$_SERVER [' HTTP_HOST ']. $ _ SERVER [' REQUEST_URI '];
Answer 2, authority 40%
From here I took: https://stackoverflow.com/questions/2820723/ how-to-get-base-url-with-php
// site URL
$ url = 'http'. ((isset ($ _ SERVER ['HTTPS']) & amp; & amp; $ _SERVER ['HTTPS']! = 'off')? 's': ''). ': //';
$ url = $ url. $ _SERVER ['SERVER_NAME']. $ _SERVER ['REQUEST_URI'];
define ('URL', $ url);
Answer 3
Returns what is needed $ _SERVER ['HTTP_REFERER']
Answer 4
header ("location: http: //site.com/razdel/index.html");
It seems to help.