【问题标题】:Url factory - google duplicate page- 301 redirect网址工厂 - 谷歌重复页面 - 301 重定向
【发布时间】:2014-03-17 13:33:55
【问题描述】:

我是这个网站的新手,希望能以正确的方式提出我的问题。

为了避免包含大量 ?id=11 等的 url 用于 SEO 目的,我构建了一个 url,允许我以这种方式重建这些 url:

http://www.example.com/blah-blah-blah-blah/ 

现在我更改了其中一些网址,因此我需要使用 .htaccess 将旧网址 301 重定向到新网址。问题是,当我重定向其中一个时,会添加 ?id=(+ number):

example: url to redirect /blah-blah-blah-blah/ 

example: url redirected to /blah-blah-blah-blah/?id=11

完成这项工作的函数是这样的:

function _prepare_url_text($string)
{

    //remove all characters that aren't  a-z, 0-9, dash, underscore or space

     $NOT_acceptable_characters_regex = '#[^-a-zA-Z0-9_ ]#';
     $string = preg_replace($NOT_acceptable_characters_regex, '', $string);

     //remove all leaidng and trailing spaces
     $string = trim($string);

      //change all dashed, underscores and psaces to dashe
     $string = preg_replace('#[-_ ]+#', '-', $string);

     //return the modified string
    return $string;

     }

     //buld a link that contains Type a Name

    function make_name_url($IDName, $ID)

     {
     // prepare le type name and acc name for inlcusion in URL
     $clean_ID_name = _prepare_url_text($AccName);

     //build the keyword reach url
     $url = SITE_DOMAIN . '/blah-blah-blah-blah-' . $clean_ID_name . '-A' . $ID . '/';

             //return the url
            return $url;
            }

所有这一切的问题在于,Google 现在认为同一页面有两个副本。谁能帮我理解我能做些什么来解决这个问题?

【问题讨论】:

    标签: php .htaccess redirect


    【解决方案1】:

    为您的网页添加规范标签。这将停止重复。

    https://support.google.com/webmasters/answer/139394?hl=en

    【讨论】:

    猜你喜欢
    • 2011-04-07
    • 1970-01-01
    • 1970-01-01
    • 2015-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-23
    • 2018-05-31
    相关资源
    最近更新 更多