trooperbill Posted February 23, 2009 Share Posted February 23, 2009 i want to use the new canonical rel tag to solve a sites duplicate content issues however im not that familiar with PHP. what i need to do is display the current pages url without the querystring anyone know how to do this? it needs to populate the following tag <link rel="canonical" href="http://www.website.com/page.php"> where the url is page.php?id=kjhjkhasdfkjhsfdkjshdf etc thanks mark Link to comment https://forums.phpfreaks.com/topic/146516-display-current-url-without-querystring/ Share on other sites More sharing options...
rhodesa Posted February 23, 2009 Share Posted February 23, 2009 $_SERVER['PHP_SELF']; Link to comment https://forums.phpfreaks.com/topic/146516-display-current-url-without-querystring/#findComment-769218 Share on other sites More sharing options...
trooperbill Posted February 23, 2009 Author Share Posted February 23, 2009 SWEET! thank you! Link to comment https://forums.phpfreaks.com/topic/146516-display-current-url-without-querystring/#findComment-769225 Share on other sites More sharing options...
trooperbill Posted February 23, 2009 Author Share Posted February 23, 2009 Hit a snag. its returning the .php filename not the url rewritten .html path which could contain folders... any fix for this? Link to comment https://forums.phpfreaks.com/topic/146516-display-current-url-without-querystring/#findComment-769264 Share on other sites More sharing options...
rhodesa Posted February 23, 2009 Share Posted February 23, 2009 try parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH); Link to comment https://forums.phpfreaks.com/topic/146516-display-current-url-without-querystring/#findComment-769266 Share on other sites More sharing options...
trooperbill Posted February 23, 2009 Author Share Posted February 23, 2009 thx u r a superstar im a total PHP n00b lol, so green its funny! Link to comment https://forums.phpfreaks.com/topic/146516-display-current-url-without-querystring/#findComment-769273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.