Tony
Tony

Reputation: 333

htaccess remove part of url and redirect

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

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

But its also created as:

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

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

Upvotes: 2

Views: 2664

Answers (1)

anubhava
anubhava

Reputation: 784898

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 (permanent redirect) will tell search bots to cache the new URL.

Upvotes: 2

Related Questions