首页 > 解决方案 > SEO 问题 Google 将我的网站 URL 编入索引两次

问题描述

我的网站索引存在一些问题。问题是我有一个使用 PHP 和 MySQL 的新闻网站。每次我创建一个新闻帖子时,都会有一个类似这个链接的 URL。

例子:

   //pretty URL
   //nameOfSite + PostId + newsTitle

    mYpagExample.com/5/the-obama-lagacy

谷歌正在索引这两种方式

    mYpagExample.com/5/  // Ii dont want this to be indexed
    mYpagExample.com/5/the-obama-lagacy

即使我将原始 URL 声明为规范,但这似乎还不够。

<link rel="canonical" href="http://mYpagExample.com/5/the-obama-lagacy">

注意:我正在使用.htaccess漂亮的 URL。

有人可以告诉我如何解决这个问题吗?

编辑

这是来自数据库示例的帖子链接:

  <a href="http://example.com/<?php echo $id?>/<?php echo $title?>/"><?php  echo $title?></a>

.htaccess 文件

RewriteEngine on

# Get the request URL  by the user
RewriteRule ^([a-zA-Z0-9/]+)$ index.php?view=$1**

标签: phpmysql.htaccessurl

解决方案


推荐阅读