I am trying to get the URL for the my webpage, but want to exclude the current file that I am working on. I have the following code, but it displays the fukl URL with the php file.
function getUrl() {
$url = @( $_SERVER["HTTPS"] != 'on' ) ? 'http://'.$_SERVER["SERVER_NAME"] : 'https://'.$_SERVER["SERVER_NAME"];
$url .= ( $_SERVER["SERVER_PORT"] !== 80 ) ? ":".$_SERVER["SERVER_PORT"] : "";
$url .= $_SERVER["REQUEST_URI"];
return $url;
This returns http://127.0.0.1:80/proyect/register_form.php
and I want http://127.0.0.1:80/proyect/