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 317 views
317 views asked Jun 14, 2018 by avibootz
1 answer 242 views
1 answer 192 views
1 answer 189 views
3 answers 343 views
1 answer 228 views
2 answers 393 views
...