Question:
How to get the current URL excluding the parameters using PHP?
Firstly, to get the current url in php use the following:
<? $current_url = $_SERVER['REQUEST_URI']; echo $current_url; ?>
For URLs with trailing parameters the following will place the first part of the current URL (i.e. the part before ?) within the variable $current_url[0] and then print it out.
<? $current_url = explode("?", $_SERVER['REQUEST_URI']); echo $current_url[0] ; ?>
For example with the URL:
http://mydomain.com/content.php?var=1&name=mike&country=uk
The following would be saved within the variable $current_url[0] and printed out.
http://mydomain.com/content.php
Taxonomy: