2013-05-28 82 views
2

試圖消除一些重複的網址。目前,我會得到這樣的鏈接:htaccess刪除部分網址並重定向

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

但它也創建爲:

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

我需要簡單地從所有URL刪除/ CATID /#和是谷歌友好重寫/重定向。有什麼建議麼?

+0

這是你想要做的嗎? http://stackoverflow.com/questions/16519637/removing-part-of-url-with-htaccess – user2386278

回答

1

你只需要一個簡單的301規則,這樣的代碼:

Options +FollowSymlinks -MultiViews 
RewriteEngine On 
RewriteBase/

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

R=301(永久性重定向)會告訴搜索機器人緩存新的URL。

+0

有人下來投了,想不通爲什麼? – anubhava