Remove the dates from WordPress URLs

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.

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:
/([0-9]{4})/([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

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.

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. 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 almost never see a year in a search query.  So why put something so important up front in the URL? There’s no reason.

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.

5 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.

Comments are closed.

%d bloggers like this:
WordPress Appliance - Powered by TurnKey Linux