Codex tools: Log in
Contents |
Redirects incoming links to the proper URL based on the site url.
Search engines consider www.somedomain.com and somedomain.com to be two different URLs when they both go to the same location. This SEO enhancement prevents penalty for duplicate content by redirecting all incoming links to one or the other.
Prevents redirection for feeds, trackbacks, searches, comment popup, and admin URLs. Does not redirect on IIS, page/post previews, and on form data.
Will also attempt to find the correct link when a user enters a URL that does not exist based on exact WordPress query. Will instead try to parse the URL or query in an attempt to figure the correct page to go to.
<?php redirect_canonical( $requested_url, $do_redirect ); ?>
Since: 2.3
redirect_canonical() is located in wp-includes/canonical.php