Vera
Vera

Reputation: 401

htaccess redirect 301

Google says that the content is duplicated
www.example.com/pagedcontent/page3 /
www.example.com/pagedcontent/page3

I redirected using redirect 301 for each page, but as they are already more than 150 pages would like to use a single instruction in the htaccess.

How to do? Please I want to redirect to www.example.com/pagedcontent/page3 (without / at end)

Upvotes: 1

Views: 346

Answers (1)

Adam Hopkinson
Adam Hopkinson

Reputation: 28795

Like this:

RewriteEngine On
RewriteRule ^pagedcontent/([A-Za-z0-9]*)/$ /pagedcontent/$1 [NC]

That will remove the trailing slash for any page under pagedcontent.

You can also use the canonical meta tag, which is a way of specifying the original copy of the page. Put a meta tag in the head of your page like so:

Google will know that all other duplicates of this page are copies of it.

Upvotes: 2

Related Questions