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 417 views
417 views asked Jun 14, 2018 by avibootz
1 answer 329 views
1 answer 271 views
1 answer 267 views
3 answers 529 views
1 answer 307 views
2 answers 516 views
...