How to get the current full URL without the filename in PHP

1 Answer

0 votes
   $s = (isset($_SERVER['HTTPS']) ? "https" : "http") . 
        "://$_SERVER[HTTP_HOST]" .
        substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1);
   echo $s;
    
   /*
   run:
        
   http://localhost/allonpage.com/includes/
    
   */

 



answered Jun 15, 2018 by avibootz

Related questions

2 answers 313 views
313 views asked Jun 14, 2018 by avibootz
1 answer 237 views
1 answer 183 views
1 answer 184 views
3 answers 336 views
1 answer 223 views
2 answers 384 views
...