【问题标题】:htaccess remove part of url and redirecthtaccess 删除部分 url 并重定向
【发布时间】:2013-05-28 21:13:01
【问题描述】:

试图消除一些重复的网址。目前我会得到如下链接:

http://www.domain.com/item/2013/05/testing-title-example/catid/175

但它也被创建为:

http://www.domain.com/item/2013/05/testing-title-example/

我需要简单地从所有网址中删除 /catid/# 并成为谷歌友好的重写/重定向。有什么建议吗?

【问题讨论】:

标签: .htaccess redirect


【解决方案1】:

你只需要一个简单的 301 规则,像这样的代码:

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteRule ^(.+)/catid/ /$1 [R=301,L,NC]

R=301(永久重定向)会告诉搜索机器人缓存新的 URL。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-20
    • 2013-03-04
    相关资源
    最近更新 更多