Remove Dates From Permalink

How do you you remove the dates from your permalink structure without ruining all the hard earned links you have developed?

Glad you asked… It really is very simple… (Note I tried the various plugins first but had issues… In the end this solution is faster for the visitor, quicker to implement, and simpler.)

Assuming your current permalink structure is /%year%/%monthnum%/%day%/%postname%/

  1. First change your permalink structure to /%postname%/
  2. Create a .htaccess file (or modify an existing file)
  3. Add this line above any other WordPress declarations: RedirectMatch 301 /dddd/dd/dd/(.*) /$1
  4. Make sure the .htaccess file is in the root of your blog

Here is an example .htaccess file direct from one of my blogs…
RedirectMatch 301 /dddd/dd/dd/(.*) /$1

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

By 301 redirecting you are telling the search engines that the content has moved to a new location. While there is typically some drop off during the transition, your blog will come back stronger for making the change.

As an example of the effectiveness…
Here is an old url: http://www.golfballdriver.com/2008/03/18/michelle-wie-and-robin-lopez-at-charity-auction-pic/
which now redirects to the new url: http://www.golfballdriver.com/michelle-wie-and-robin-lopez-at-charity-auction-pic/

Originally posted 2009-02-02 12:30:17. Republished by Blog Post Promoter

No related posts.

If you liked this article, vote for it on del.icio.us and stumbleupon.



Categories:

Blog Tips



Tags:

, , , , ,


9 comments ↓
#1 Brad Hart @ A DoFollow Blog on 12.11.08 at 11:09 am

I have long been a proponent of using /%category%/%post-slug%/ for your permalink it not only adds a searchable keyword if you did your categories right, but only using the post slug can often times cause plugin errors with some of the more popular plugins.

I also recommend leaving the htaccess file alone unless you really know what you are doing. I also find it easier to use the redirection plugin since often times you will want or need to optimize a post slug or a lot of post slugs depending on the age of your blog. Even if it isn’t that old removing the trash words that get stuck in by default is a good SEO practice.

#2 kevin on 12.11.08 at 11:27 am

I tend to use more than one category and so I end up with a lot of posts in the categories with that start with letter earlier in the alphabet.

I have never had any toruble with just using the post slug.

#3 MLR on 05.21.09 at 7:43 pm

Currently I use:
/%year%/%monthnum%/%postname%/

I think I want to change it to:
/%postID%/%postname%/

What would the htaccess look like for that? And would that be just as good for SEO as your improvement?

#4 Levon on 03.20.10 at 3:01 pm

If I want to use:
/%postID%/%postname%/

What would the .htaccess code be?

#5 John on 07.13.10 at 12:58 pm

I’m new to redirects, and wasn’t able to get it to work with the example above until I reliezed that the “dddd” and “dd” need to be regular expressions.

Here’s what I used and it worked

RedirectMatch 301 /[0-9]{4}/[0-9]{2}/([^/]+)/ /$1/

#6 Jim Kitzmiller on 09.04.10 at 3:01 pm

John,

The regular expression version worked for me. Thank you.

Jim

#7 Larry James on 10.27.10 at 7:43 pm

I has been my understanding that while /%category%/%postname% is perhaps the most search engine friendly url, it is not the best option for performance. I use/%postID%/%postname%/ because I have learned that it is best to start your permalink structure with a number, such as the year or post ID.

#8 TJ on 07.12.11 at 2:16 pm

This regex will work for sites that had been using the
/%year%/%monthnum%/%day%/%postname%/ structure. It is also tolerant of WordPress installs in subdirectories of the docroot – like http://www.foo.com/pub/myblog/1999/11/11/my-awesome-post/
RedirectMatch 301 (/[^/]+)?/\d{4}/(\d{2}/){2}(.*) $1/$3

#9 Vikram Sawant on 02.03.12 at 12:57 pm

Me too prefer to use /%category%/%postname%/ categories are usually the keywords so using a keyword in link is good for SEO :)

Leave a Comment