Posted By

cerxx on 10/08/19


Tagged

php-hacks


Versions (?)

PHP Get a URL address without GET parameters in it


 / Published in: PHP
 

URL: http://fkn.ktu10.com/?q=node/7233

To get a URL without GET parameters, we break the request address into two parts by the "?" Sign:

  1. $uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
  2. echo 'http://' . $_SERVER['HTTP_HOST'] . $uri_parts[0];

Report this snippet  

You need to login to post a comment.