Press "Enter" to skip to content

Block indexing wordpress date arhives pages

vpandzic 0

Duplicate content is one thing that can harm your Search Engine Optimization (SEO) badly. Let’s imagine this common example: You created post today (28/08/2017) and it is called “Block indexing wordpress date archives page”. By default, wordpress will create this link for this post: I am really not big fan of date inside your url (I more like category, but more about that later). You put that post inside “SEO” category and it is only post inside that category. By default, wordpress will create link. WordPress also creates links for year, month and day archive. For example, at link you can see all posts you published at that date. If it’s that your only post you published that day, and considering facts mentioned earlier all of the sudden your and have almost completely same content.

First of all, you will need to “remove” eather page. I think it is useful for user to have few ways of navigating your page (image calendar widget in your sidebar for date arhive pages),so completely removing was not my option. However, duplicate content is obviously big SEO problem so I decided to tell Google to stop indexing my date archives page (year arhive page:, month archive page: and

Unfortunatelly, robots.txt doesn’t allow complex regular expressions. You can dissalow folder, but regular expressions are not supported. If all date archives page had some “prefix” like, it would be much easier, because all I would need to do is put: Disallow: /dates/* inside by robots.txt file. I decided to rewrite my date arhives urls and redirect them so have this pattern{year}/{monthnum}/{day}.

But before explaining this let’s go step backward and explain how my other links look like (so you can see from where were are starting from, and why it maybe doesn’t work in your particular case).

Making post and category links more SEO and user friendly

My post URLs now look like this:{category}/{postname} instead of default{year}/{monthnum}/{day}/{postname}. Not only that flatter structure would probably give more importance to the link from SEO perspective, but, more importantly use experience will improve. Most users will naturally put your posts inside some type of categories, so your url should reflect that. If they have{category}/{postname} some users will delete {postname} from url to try to read more about that particular {category} current post belongs. Also, if your wordpress site has breadcrumbs, category will also show in breadcrumb: Home>>Category>>Post name. This feels more naturally from UX, if parent category is SEO, rather than 2017/08/28. Users want to read about SEO, not to find out you wrote today (But if they do, they have calendar sidebar widget mentioned earlier).
This is how you would change your POST url:
Go inside Settings>Permalinks and choose Custom. Type %category%/%postname% like in image below:

Make your post urls have category inside them

I also changed how my urls for my category pages look like. If my post url had page, I wanted my category url has this url: instead of default I accomplished that without coding using Yoast SEO plugin. If you want that your wordpress page has good SEO you already have it installed. If you have it installed in left sidebar choose SEO>Advanced>Permalinks and then select “Remove” from ” strip the category base (usually /category/) from the category url”. If you can’t see Advanced Option go in Dashboard/Features and enable Advanced features.

Inside advanced option there is also option to enable breadcrumbs (they already have HTML5 microdata markup!), and to choose how breadcrumbs for post page should look like (in my case I selected they should have category as they parent).


Removing duplicate content by disallowing date arhive pages

Now, let’s see how I handled date arhives links. I changed my .htaccess file (you can go inside cPanel, connect over FTP or open SEO>Tools>File editor.

This is my configuration:

RewriteEngine On
 RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/?$ /dates/$1/$2/$3/ [R=301,L,NE]

RewriteEngine On
RewriteRule  ^([0-9]+)/([0-9]+)/([0-9]+)/page/([0-9]+)/?$ /dates/$1/$2/$3/page/$4  [R=301,L,NE]

RewriteEngine On
 RewriteRule ^([0-9]+)/([0-9]+)/?$ /dates/$1/$2/$3/ [R=301,L,NE]

RewriteEngine On
RewriteRule  ^([0-9]+)/([0-9]+)/page/([0-9]+)/?$ /dates/$1/$2/$3/page/$4  [R=301,L,NE]

RewriteEngine On
 RewriteRule ^([0-9]+)/?$ /dates/$1/$2/$3/ [R=301,L,NE]

RewriteEngine On
RewriteRule  ^([0-9]+)/page/([0-9]+)/?$ /dates/$1/$2/$3/page/$4  [R=301,L,NE]

There are 6 rules total, for year, month and date arhives and also for each of them there is variation that includes page parametar. Remember that almost very page in wordpress can be paginated so it is neccessary to handle those pages. Unfortunattely that wasn’t enough. If I do to I get redirected to but I get 404.

I needed to tell wordpress about rewrite rules. I decided to make plugin. Here is code for plugin:

*Plugin Name: SEO-date-archives-pages
*Plugin UIR:
*Author: VP
add_action('init', 'rewrite_rule_example');
function rewrite_rule_example() {



Leave a Reply

Your email address will not be published. Required fields are marked *