php - 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**
解决方案
推荐阅读
- swift - 如何在 BodyEntity 中以编程方式访问剔除模式和双面?
- javascript - 如何生成这个 JSON 对象?
- discord - 检查具有特定角色的用户是否对最新的机器人消息作出反应 | 不和谐.js
- gstreamer - Gstreamer 在编码 ts 段时保留时间戳
- php - 下载计数仅更新并显示第一行
- maven - 安装 maven 依赖项解析为 pom 到自己的存储库
- unit-testing - 如何在 python3 中模拟自定义异常?
- python - 逐个元素地迭代查询字符串上的列表
- python - seaborn displot 使用向量字符串定义列顺序
- java - AccessDeniedException WatchService android studio