htaccess的删除网址的一部分,并重定向 [英] htaccess remove part of url and redirect

查看:194
本文介绍了htaccess的删除网址的一部分,并重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图消除一些重复的URL。目前,我会得到这样的链接:

Trying to eliminate some duplicate urls. Currently I will get links like:

http://www.domain.com/项目/ 2013/05 /测试 - 标题 - 例如/ CATID / 175

但它也创造为:

http://www.domain.com/item/2013 / 05 /测试 - 标题 - 例如/

我需要简单地从所有的URL删除/ CATID /#和是谷歌友好的重写/重定向。有什么建议?

I need to simply remove the /catid/# from all urls and be google friendly rewrites/redirects. Any suggestions?

推荐答案

您只需要一个简单的301规则,像这样code:

You just need a simple 301 rule like this code:

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /

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

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

R=301 (permanent redirect) will tell search bots to cache the new URL.

这篇关于htaccess的删除网址的一部分,并重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆