iBlognet

How to Remove Post Date From WordPress Permalinks

by Sahil Umatia

Remove Post Date From WordPress Permalinks WordPress allows bloggers to set custom permalink structure by adding post dates in the permalinks making it look more organized in nature. The main advantage of using dates in the permalink is that it provides immediate information about the article freshness, when was it published. Also it creates a better hierarchy of articles, if you want to search for specific post.

But putting dates in permalinks has very few benefits and personally I didn’t liked the idea of adding dates in permalinks until I switched from Blogger to WordPress. I maintained the same permalinks as it was previously on Blogger as I was unaware of WordPress SEO. So after researching some pros and cons about permalinks structure’s I found there are two best permalink structure.

1. domain.tld/%postname%.html

2. domain.tld/category/%postname%.html

And I decided to go with the first one, because the URL looks much clean, short and sweet. So the first thing was to change the permalink structure in the WordPress settings section, so all my future post will be posted in new permalink structure.

Step 1 – Changing permalink structure

Go to Settings > Permalinks > and add the following custom permalink format and save the changes.

/%postname%.html

Permalink Settings

Wait! That’s not all! If you have previously published article with dates base permalinks, it would result in a 404 page from search engines and other social networking sites where you’ve submitted the post. So a simple solution to this would be to add a 301 redirect via htaccess.

Step 2 – Adding 301 Redirect via .htaccess

Login to your web server account via FTP and search for .htaccess file in the ” root directory ” of the domain.

Download the file locally on your computer and edit it with Notepad or Notepad++. You can add redirect using mod rewrite or mod alias rule. Use any one.


Using MOD REWRITE RULE

Remove Existing Permalink Format Add
Year/Month/Day /%year%/%monthnum%/%day%/%postname%.html RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/?$ http://domain.tld/$4/ [R=301,L]
Year/Month /%year%/%monthnum%/%postname%/.html RewriteRule ^([0-9]{4})/([0-9]{1,2})/([^/]+)/?$ http://domain.tld/$3/ [R=301,L]
Year /%year%/%postname%/.html RewriteRule ^([0-9]{4})/([^/]+)/?$ http://domain.tld/$2/ [R=301,L]

Change domain.tld with your domain name. See the image below. You should add the code in the mod_rewrite.c module.

Remove Permalink Via htaccess

 


Using MOD ALIAS RULE

Remove Existing Permalink Format Add
Year/Month/Day /%year%/%monthnum%/%day%/%postname%.html RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://domain.tld/$4
Year/Month /%year%/%monthnum%/%postname%/.html RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://domain.tld/$3
Year /%year%/%postname%/.html RedirectMatch 301 ^/([0-9]{4})/([^/]+)/$ http://domain.tld/$2

Change domain.tld with your domain name. See the image below. You should add the code in the mod_alias.c module.

Remove Permalink Via htaccess1

Save the .htaccess file and replace it on your server. Check if the redirect is working by clicking few old URL’s structures. You can find them on search engines or social networking sites. That’s it, you’re done, redirecting old URL structure without any plugin! Thanks to Joost de Valk for creating redirect generator. Image Credits: Caro’s Lines

ug8vsywtk3t

Article by »


Sahil is the founder and editor of iBlognet. He is a freelance writer on topics related to Website Optimization (SEO), Blogging, and Tech. He also specializes in SEO, HTML, CSS and Photoshop. Sahil has written 277 fantastic article(s) on iBlognet.


Author Site » Know me More

Author Connect »

{ 8 comments… read them below or add one }

1 KBharath

Thank you for sharing this clean tutorial on removing the dates in wordpress permalinks.
KBharath invites you to read Funny Caricature of Famous Peoples Around the WorldMy Profile

Reply

2 Danilo

Great tutorial, it’s really useful! thanks

Reply

3 Charles

Thanks for the post. Removing dates from you posts sometimes is very important, most especially, the new bloggers. I have some blogs, most of them have the date setting while others do have it. Thanks again

Reply

4 Kashish

I have a blog and have been running it past one year with ‘year’ in the permalinks. Now I want to remove ‘year’ from the permalinks but doings removes all the google +1′s and fb likes on individual posts. As these are important with panda updates I want to keep them.
So is there any solution to it ?

Reply

5 Sahil Umatia

Sorry for the late reply. Don’t know, but your comment was marked as spam. Anyways, no you cannot keep those G+1′s and fb likes on individual post. But your post are still available on those networking sites. And there’s no need to worry, until they are not resulting in any 404 page and you have set proper redirection on your blog URL’s.

Reply

6 Hector Torres

Thanks for this post about the rewrite rule after changing WP permalinks. It came in very handy.

One quick suggestion to help your readers: when they copy the code from the table (see example below), they will get an unnecessary space between “http://” and “domain.tld” and between “domain.tld” and “/$4″. This could be confusing to some novice readers :)

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http:// domain.tld /$4

Thank again!

Reply

7 Sahil Umatia

Thanks for the tip Hector! I have updated the post.

Reply

8 Toufiq

i am using NGinx, any help?
Toufiq invites you to read JSC Scholarship Result 2012 All BoardMy Profile

Reply

Leave a Comment

We're glad that you chose to leave a comment. This blog uses KeywordLuv. Enter YourName@YourKeywords in the "Name" field to take advantage of link juice for your anchor text. Please keep in mind that all comments are moderated. Let's have a meaningful conversation.

CommentLuv badge
This blog uses premium CommentLuv Premium which allows you to put your keywords with your name if you have had 1 approved comments. Use your real name and then @ your keywords (maximum of 2)

Previous post:

Next post: