首页 WordPress函数大全 redirect_canonical()

redirect_canonical()

2020-05-02 / 3829阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

redirect_canonical( string $requested_url = null, bool $do_redirect = true )

将传入链接重定向到基于>的正确URL

Contents

  • Description
    • Parameters
    • Return
    • Source
    • Changelog
  • Related
    • Uses
    • Used By
  • User Contributed Notes

描述

搜索引擎将www.somedomain.com和somedomain.com都放在同一位置时,它们是两个不同的URL。通过将所有传入链接重定向到>,此SEO增强功能可防止重复内容受到惩罚

参数

$requested_url

(string)
(Optional)
The URL that was requested, used to figure if redirect is needed.

Default value: null

$do_redirect

(bool)
(Optional)
Redirect to the new URL.

Default value: true

返回

(string|void) The string of the URL, if redirect needed.

大家谈论
    我的见解