Remove the dates from WordPress URLs

Last Updated on August 17, 2018 by Dave Farquhar

For months, I had a goal to remove the dates from WordPress URLs (or permalinks) on my site. It seems like everyone is doing this, but nobody explains how to do it simply or easily. So I’m going to share my method. Removing the dates from WordPress URLs is a surprisingly effective way to get more traffic.

Why I was apprehensive about removing dates

When you remove the dates, it means all of your URLs change. Web servers have a way of dealing with that, called redirection. They take your old URL and translate it to the new one transparently. Search engines recognize it and they don’t penalize you for duplicate content. Eventually they improve your search rank, yet everything else still works like nothing happened, and everyone’s happy.

Redirecting made me nervous because it usually means editing .htaccess files. I run a security plugin that’s constantly editing my .htaccess file to block threats–effectively it’s using .htaccess as a simple web application firewall. It shouldn’t clobber my redirects. But if you’ve been around computer systems any length of time, you know how that goes.

I’m perfectly comfortable editing plaintext files, but I realize not everyone is.

Enter the Redirection plugin

By using the Redirection plugin, you can manage your redirects from within WordPress. The other thing Redirection does is log your 404 errors. These logs are very helpful. You can use them to watch how bad guys are trying to get into your site. Seeing a handful of people trying to hack your site every day is enlightening.

I happen to have legacy content from the days before I ran WordPress; so I had about 200 redirections in place before I decided to change my URLs. If you don’t, then this is going to be really easy.

In my case, I had to export my existing redirections, edit them to remove the dates, then reimport to avoid a redirect to a redirect. Using search and replace, it didn’t take me long.

Two steps to remove the dates from WordPress URLs

Yes, you really can remove the dates from the URLs in just two steps, which seems rather anticlimactic. If you don’t have Redirection installed, installing Redirection counts as step 0.

First, click Settings, then Permalinks. Select Post Name. Click Save changes.

Next, click Tools, then Redirection. Click Groups and create a group if you don’t have any redirects yet. Then click Redirects and scroll down to the section called Add New Redirection.

Under Source URL, enter the following if your dates are just the year and month:
/([0-9]{4})/([0-9]{2})/(?!page/)(.+)

If your dates are the full date, enter this under Source URL instead:

/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)

Be sure to check the box next to Regular Expression.

Under Destination URL, enter your URL followed by /$3 — here’s mine:
https://dfarq.homeip.net/$3

If you don’t use https, I recommend you start, but in the meantime, use something like this for your Destination URL instead:

https://dfarq.homeip.net/$3

Leave the fields labeled Match and Action alone. Pick your group, then click Add Redirection.

Here’s what it looks like in the user interface:

remove the dates from wordpress urls

Again, make sure you enter your URL, not mine. You and your readers don’t want your traffic going to me.

That’s it. Your mission to remove the dates from WordPress URLs is done. Visit your site and click around a bit to make sure everything works. Navigate back to Tools -> Redirection -> 404s and look for errors just to make sure.

Change your permalink structure

There’s one more step. After you add redirects for your existing content, you need to change your permalink settings. Navigate to Settings > Permalinks and choose Post Name instead of Day and Name or Month and Name.

Your backout plan

Always have a backout plan. If anything goes wrong, click Settings, then Permalinks. Select Month and Name. Click Save Changes.

Click Tools, then Redirection. Scroll to the redirection you created above, then hover under it and click Disable. Then navigate to Settings > Permalinks and change Post Name back to Day and Name or Month and Name, whichever you were using before. Now your blog is back in the state you began with.

Why remove the dates?

OK, now we can talk theoretical stuff. If you’re not interested, just skip the rest of this entry and go back to what you were doing.

SEO experts recommend removing the dates from your URLs. There was a time when having them helped. Today, some experts believe having the dates penalizes you unless you’re a news site. At the very least, the year and month are taking up valuable space in the middle of the URL, pushing the important search terms further in the back.

I look at the search queries people use to find my site, because I want to know if I answered people’s questions. I can tell you I rarely see a year in a search query, and I can’t tell you the last time I saw a month.  So why put something so unimportant up front in the URL? There’s no reason, except it’s a trick that helped in 2005. As someone who was blogging in 2005 and now, I can tell you most of what helped in 2005 doesn’t help you anymore.

Playing the SEO game

I wrote off the effects of SEO (search engine optimization) until I saw the effects of modern SEO firsthand. Modern SEO is a lot harder to game than it was in years past.

SEO extends on what they teach professional writers in school. When I was in journalism school, they taught us to use the first paragraph to hook in a reader, and to use the last paragraph to wrap everything up. In between, you inform the reader, tell a story, solve a problem, and make the reader want to keep reading. That part of writing will never be obsolete.

But there are some tricks you need to do to get search engines to get you a reader. Changing your URL structure is one of them. I may also interject one sentence in the first paragraph that’s designed for the search engine. My former professors, instructors and teachers would bristle at some of those lines, but without them, I might not get that click. Today you have to hook the search engine and the reader. I use the rest of that paragraph trying to hook the reader. If they don’t bounce right back to the search engine, the engines notice, they rank me a bit higher, and the cycle starts all over again.

It’s an inexact science, and I don’t claim to have mastered it. But I’m in the game.

If you found this post informative or helpful, please share it!

11 thoughts on “Remove the dates from WordPress URLs

  • February 12, 2017 at 10:14 pm
    Permalink

    Thank you for sharing your great information about how to remove the dates from wordpress URLs. The article is really informative and helpful. It’s definitely going to help many of the readers. Keep sharing such posts.

    • February 13, 2017 at 2:06 pm
      Permalink

      Thanks, I’m glad you found it helpful.

  • June 14, 2017 at 9:20 pm
    Permalink

    This is working for me as long as the source url does not end with a trailing forward slash (/). How do I get this to work regardless if the url ends with /?

  • July 23, 2017 at 8:45 pm
    Permalink

    Has your search traffic improve since implementing these changes?

    • July 24, 2017 at 7:13 am
      Permalink

      Yes. I saw a 20% improvement within two months, so it was definitely a worthwhile change.

  • March 7, 2018 at 9:02 am
    Permalink

    How long until google updates the new URLs? I’m new to all of this. I did make the changes and it worked. Thank you!

    • March 7, 2018 at 11:01 am
      Permalink

      Glad it helped. It varies, but when I did it, I saw the effects within the month. You should notice the change in Google search results and you should also notice your more popular posts getting slightly more traffic.

  • August 17, 2018 at 7:08 am
    Permalink

    This is very helpful! I was wondering whether you might have the source url / destination url to input for a wordpress site where the original permalink included the whole date and not just the year and month? For example blog.com/2018/08/17/post-name rather than the blog.com/2018/08/post-name that was in your example.

    Because I tried the above for my site which has the complete date in the URL and afterwards, one leg of the date still appears. Thanks!

    • August 17, 2018 at 8:17 am
      Permalink

      Sure thing for whole dates, use this regular expression instead of the one above:

      /([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)

      Let me know how that works for you.

      • August 17, 2018 at 7:09 pm
        Permalink

        Thank you. With this source URL, is it necessary to put in a different kind of destination url or does the https//blog.com/$3 still apply in this case?

        • August 17, 2018 at 8:04 pm
          Permalink

          Ah, now that you mention it, you probably do need to change the $3 at the end to $4 on the destination.

Comments are closed.