To get the current page URL, PHP provides a superglobal variable $_SERVER. The $_SERVER is a built-in variable of PHP, which is used to get the current page URL. It is a superglobal variable, means it is always available in all scope.
If this url is open then this url should be refreshed or go to here
- <?php$domain = $_SERVER[‘SERVER_NAME’];
$afterpath = $_SERVER[‘REQUEST_URI’];
$url = “https://”.$domain.$afterpath;
?><?php
if($url=”https://uti.mypancenter.in/portallogin/index.php”){?>
<script>
setTimeout(function(){location.href=”https://uti.mypancenter.in/portallogin/index.php”} , 30000);
</script>
<?php
}
?>
- <?php
- if(isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] === ‘on’)
- $url = “https://”;
- else
- $url = “http://”;
- // Append the host(domain name, ip) to the URL.
- $url.= $_SERVER[‘HTTP_HOST’];
- // Append the requested resource location to the URL
- $url.= $_SERVER[‘REQUEST_URI’];
- echo $url;
- ?>
$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. That said, a large number of these variables are accounted for in the » CGI/1.1 specification, so you should be able to expect those.