I want to redirect all the paginated pages of the category pages to their respective category pages, because I don't want google to crawl the paginated pages.
If my paginated category page URL is:
http://example.com/category/cat-name/page/4/
I want to redirect to:
http://example.com/category/cat-name/
This case can be anything from different page numbers to different category names.
How can I achieve that using .htaccess
?
I'm running a WordPress site and already there are several redirects active:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^[0-9]+/([^/]+/[^/]+/?)$ /$1 [L,R=301,NE]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
EDIT
First of all, some of my .htaccess rules are based on this StackOverflow Q&A. Because I need 'em to be there.
So, after your comments, I got the point. With such a redirection in action my paginated pages won't be accessed ever, even after a hard-coded URL. Yes, that'd be a mess.
Actually, you know WordPress category pages are auto generated with the number of posts. Suppose, in "Astronomy" category I got 32 posts and in each page I'm showing 10, then there would be 4 pages (10+10+10+2). Eventually I deleted two of the posts or recategorized them to another category. So the fourth page become orphan. Google crawls and got a 404. It's a continuous process and looking for such 404 hits is a critical matter for me. So I's looking for a solution.
What can I do for such problem?