【发布时间】:2014-12-04 22:46:07
【问题描述】:
我已经把我的 php 网站 url 改写为,
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[A-Za-z0-9-_]+/([A-Za-z0-9-_]+)/?$ product.php?uni_id=$1 [NC,L] #
所以,旧网址是,
http://example.com/product.php&uni_id=laptop-123
新的网址是,
http://example.com/products/laptop-123/
现在,当搜索引擎返回时,他们应该通知(旧网址永久移动到)新网址,或者我可以从搜索引擎中删除所有条目,以消除搜索引擎中的重复条目。
现在,就 seo 目的而言,在编写 url 后我必须做什么。
注意:我听说过使用301 redirects,但不知道如何实现它。
【问题讨论】:
-
你被误导了,没有搜索引擎在乎 url 是什么样子
-
我的意思是在搜索引擎中新的 url 应该用旧的 url 替换。那么如何处理重复的网址?
-
如果旧 url 返回 404 它将被删除,如果新 url 链接到任何将被索引的地方。
-
没有。旧 url 不返回 404。新旧 url 都指向同一个页面。
-
在 product.php 中检查 uni_id 是否存在,如果存在则返回 404 或重定向到主页或任何您想要的。这就是为什么你不应该首先做任何改变:-)
标签: php apache url url-rewriting seo