Skip to main content
7 events
when toggle format what by license comment
Jul 3, 2019 at 12:25 comment added Simon Hayter @DocRoot Good point, updated the answer with $url=strtok($_SERVER["REQUEST_URI"],'?'); which will remove the query strings completely.
Jul 3, 2019 at 12:25 history edited Simon Hayter CC BY-SA 4.0
added 152 characters in body
Jul 3, 2019 at 11:46 comment added DocRoot "The PHP code $_SERVER['REQUEST_URI'] will get the relative path" - Note that the PHP superglobal $_SERVER['REQUEST_URI'] also includes any query string - so this value needs to be parsed to extract the desired URL-path to be useful (not to mention the potential XSS vulnerability of using this value directly in the HTML source).
Mar 19, 2017 at 17:53 comment added user3574492 Thanks very much, its working great. Much more elegant solution than setting the canonical per page / post.
Mar 19, 2017 at 17:52 vote accept user3574492
Mar 19, 2017 at 16:06 history edited Simon Hayter CC BY-SA 3.0
added 643 characters in body
Mar 19, 2017 at 15:59 history answered Simon Hayter CC BY-SA 3.0