For any website, URL structure is one of the most important factors for good SEO ranking. However, there are times when a webmaster didn’t start his/her website with proper URL structure and wants to change it later on when the site becomes popular. If done improperly, this can lead to tons of 404 errors and a drop in SEO ranking.

In this quick guide, let us see how to change WordPress permalink structure from date or category-based to post name-based URLs with proper redirects from old URLs to new URLs.

Note: This guide only covers the scenarios for WordPress installed in the root directory and not for the WordPress installed in the sub directory. It is also assuming that you are using Apache as your web server.

The first thing you need to do is to change the WordPress permalink structure to “Post name” in your WordPress dashboard. To do that, open up your WordPress admin dashboard and navigate to “Permalink” (settings -> permalinks).

change-wp-permalinks-settings

Here in this screen, select the radio button “Post name” under common settings and click on the save changes button to apply the changes.

change-wp-permalinks-post-name-permalink-structure

Once you have done that, check if all the posts and pages are working as they should without any errors whatsoever. If everything is fine at this point, you can head to the next step of creating .htaccess rules for proper redirects.

Creating .htaccess Rules

Now the second step is to add the below redirect rules to your .htaccess file located in the root directory so that all the old URLs will be properly redirected to the new URLs. That way you won’t lose any traffic or the search engine rankings. Just go through the scenarios below, find the ones you were using in the past and copy paste the .htaccess rule.

Note: If you are using “www” in front of your domain name, then add that “www” to the .htaccess rule you are going to use.

Remove “/year/month/day” from the URL

If your old permalink looks something like this,

http://example.com/2014/08/21/post-name

then use the redirect rule below to redirect this old URL to the new post-name only URL.

# Remove year and day from permalink structure
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://example.com/$4

Remove “/year/month” from the URL

If your old permalink looks something like this,

http://example.com/2014/08/post-name

then use the redirect rule below to redirect this old URL to the new post-name only URL.

# Remove year and month from permalink structure
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://example.com/$3

Remove “/category/” from the URL

If your old permalink looks something like this,

http://example.com/category/post-name

then use the redirect rule below to redirect this old URL to the new post-name only URL.

# Remove category from permalink structure
RedirectMatch 301 ^/([^/]+)$ http://example.com/?p=$

Redirect “/archive/post-id” to Post Name Structure

If your old permalink looks something like this,

http://example.com/archive/123

then use the redirect rule below to redirect this old URL to the new post-name only URL.

# Redirect archive to post name structure.
RedirectMatch 301 ^/archives/(\d+)$ http://example.com/?p=$1

That’s all there is to do, and it is that simple to change permalink structure for an already established website. Hopefully that helps, but do comment below if you face any problems while changing or redirecting the URLs.

How To Save Highlighted Text in Firefox Into a File

Researching on the Internet can sometimes be cumbersome. The Save Text To File extension for Firefox allows you to save highlighted text in any web page into a .txt file, then save it in any location on your hard drive.

4 Things You Should Know About Digital Cryptocurrencies (Bitcoin, Litecoin, PPCoin, Etc.)

The Internet has entered a new era in which people can start trading in currencies that are not run by governments, called cryptocurrencies. If you have heard all the hype and wanted to get involved, it’s best that you find out more before investing in digital cryptocurrencies.

Get the Black Google Menu Bar Back with this Chrome Extension

Don’t like the new Google App Launcher? Want to get the old black Google menu bar back at the top of Google websites? Here’s how to do that in Chrome.

Identify the Fonts on Any Web Page [Chrome]

WhatFont is a Chrome extension that will identify the fonts used on any web page, just by hovering your mouse over them. No more web font guessing!

Is Your Email Provider Leaking Your IP Address to Recipients? Here’s How to Find Out

If you care about your privacy, you need to make sure that your email provider is not leaking your IP address to recipients. Here’s the tool for the job!

How to Fix Chrome’s Extension Security Problems

Some of the extensions in Chrome store are using hidden adware to make money off of you. Here are some fixes for you to tackle the extension security problems.

How to Set Up and Use Mozilla’s Firefox Accounts

Firefox Sync is getting better in the new nightly version of Firefox. If you have not setup your Firefox account, here is how you can do so.

Using the New Microsoft Office App in Chrome

Following up to its revamp of the office web apps, Microsoft released a Chrome extension that allows you to use Office in Chrome browser. Let’s check it out.

Import Email From Other Services to Outlook.com Using IMAP

With Outlook.com, it seems that Microsoft has hit the jackpot with an email service that competes with Gmail. Read on to find how to import IMAP messages.

End-To-End Encryption (And Principle) Explained

You probably have heard the term “end-to-end” plenty of times, but what is it really about? Read on to find out more.

Firefox – Which Variant Should You Use?

With the open-source nature of Mozilla’s Firefox, there are many variants that you can use. The question is, which one is the best and which should you use?

Three Ways To Educate Yourself Right Now About Internet Censorship

The Internet isn’t free, as much as you like it to be. This article examines 3 of the best online resources where you can learn about Internet censorship.