Get current URL excluding parameters in php
Question
How to get the current URL excluding the parameters using PHP?
Answer
The following will place the first part of the URL (before ?) and place it within the variables $current_url[0] and then prints it out.
<?
$current_url = explode("?", $_SERVER['REQUEST_URI']);
echo $current_url[0] ;
?>
For the URL:
http://mydomain.com/content.php?var=1&name=mike&country=uk
Just:
http://mydomain.com/content.php would be saved within the variable.