I am using the following code to grab the url: function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } Code (markup): Then I can echo on my page the url by using: <?php echo curPageURL();?> Code (markup): But I just realized that I need to modify this because if someone comes to my site with an for example mydomain/mypage.php?=data Then the url displayed on my page displays: mydomain/mypage.php?=data I do not want to display the ?=data I really do not want to display the ? and including anything at all after it. That "data" part could be anything so I only want to display mydomain/whatevermypageis.php and nothing else How could I do this? I appreciate your help Thanks Mike
Thanks for your reply. Yes I can see how that would work but have places in my page where I do need to echo the whole string with the ?data= on the end. I am really looking for a way to echo the url but a cleaned up version of the url. Is it possible to strip ? and everything after it? when I echo the url? Thanks