Dynamic Canonical Link Code - Need 2 Refactored Versions - Remove Param / Query Strings

Posted by Bryan Hadaway on Stack Overflow See other posts from Stack Overflow or by Bryan Hadaway
Published on 2010-05-26T04:49:26Z Indexed on 2010/05/26 4:51 UTC
Read the original article Hit count: 524

Filed under:
|
|
|
|
function canlink() {
echo '<link rel="canonical" href="http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '" />';
}

Need one version that removes just & and everything after and another that removes ? and everything after, I've been looking for a clean minimalist solution for the past 2-3 days with nothing close.

Thanks, Bryan

© Stack Overflow or respective owner

Related posts about query

Related posts about dynamic