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 Reduce PNG Image File Size Online

PNG is a great format for preserving image quality, but it is usually larger in file size compared to other image format. If you are looking for a simple and effective way to reduce PNG image file size without installing additional apps on your PC, here is how you can do it online.

Track Time and Goals Using Progress Bar Timer [Google Chrome]

Tracking your time and task can be a difficult job. While some may have no trouble keeping track of time in their heads, others may benefit from a more visual means of measuring progress. Progress Bar Timer is a Google Chrome extension that turns deadlines and quotas into convenient progress bars to help track time and goals.

How BitTorrent DHT Peer Discovery Works

Peer discovery is an essential part of the BitTorrent protocol. It’s how its downloads happen so quickly: You connect to multiple people, and each of them upload a little piece of the file to you. This article explains how the whole BitTorrent DHT peer discovery process works.

4 Popular Bitcoin Alternatives and How They Compare to Bitcoin

The cryptocurrencies is here to stay. Bitcoin may be receiving the most attention at the moment, but it is definitely not the only one around. There are tons of Bitcoin alternatives. Here we will take a look at the 4 popular Bitcoin alternatives and see how they compare to Bitcoin.

Secure Your Yahoo Account With Second Sign-in and App Password

Yahoo has added a feature called Second Sign-in that allows you to secure Yahoo account with two factor authentication. Here’s how you can enable it.

Surfly Lets You Browse the Web with Friends Without Installing Software

Surfly is a free web app that lets you browse the web with friends in just a few quick steps; enter a website, share a short URL & start surfing.

5 Great Sites That Help You Build Creative CVs

Your resume is an important part of your professional life and it doesn’t have to be boring. Here are 5 of the best sites to build a nice and creative CV.

Do Sentences Make Better Passwords?

One proposition that security experts made recently was to use short sentences as passwords, rather than a complicated string of characters. Let’s see if this is a more secure method.

What You Need to Know About Future Web Standards (That are Making the Internet Better)

The Internet started 40 years ago and many things have changed since then. Let’s take a look at the future web standards and how they improve the Internet.

Big List of Tools and Services to Help You Read Everything Faster

With the overwhelming information in the Internet, it has become necessary for us to read faster. Here are some tools to improve your reading speed.

Organize Firefox Bookmarks with ViewMarks

ViewMarks puts a creative twist on your Firefox bookmarks using a file manager paradigm. It lets you manage your bookmarks like they’re files and folders.

A Beginner’s Guide to Not Being Compromised on the Internet

You may understand what social engineering is, but are not sure how to properly defence against it. Here are a couple of advices for you.