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

  1. <?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
    }
    ?>

 

 

  1. <?php  
  2.     if(isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] === ‘on’)   
  3.          $url = “https://”;   
  4.     else  
  5.          $url = “http://”;   
  6.     // Append the host(domain name, ip) to the URL.   
  7.     $url.= $_SERVER[‘HTTP_HOST’];   
  8.     
  9.     // Append the requested resource location to the URL   
  10.     $url.= $_SERVER[‘REQUEST_URI’];    
  11.       
  12.     echo $url;  
  13.   ?>   

$_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.

Leave a Reply

Your email address will not be published. Required fields are marked *