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.

Converting Files In Google Drive With DriveConverter

If you’re looking for a built-in tool to convert files in Google Drive, then try DriveConverter, a web app and Chrome extension specially built for Google Drive. It offers more flexible conversion features for documents, images and music files.

The Complete Guide to Avoid Scams on Craigslist

Craigslist is a popular place for people to buy and sell stuff. It is also a good hangout for fraudster to scam the user. This guide will teach you how to avoid scams on Craigslist.

15 Clocks For Telling Time Within Google Chrome

Your computer came with a clock that is functional enough, but there are so many more ways you could have your computer tell you the time. The Chrome Web Store is filled with various clock apps and extensions. Here are 15 options that might just add an extra bit of excitement to how you check what time it is.

How to Copy All Links on a Web Page in Firefox

Have you ever wanted to copy all links on a web page while browsing? This Firefox add-on lets you copy all links on a web page in a matter of seconds.

How to Import your Instapaper Articles into Pocket

If you are planning to import Instapaper articles to Pocket, the procedure to is extremely easy and shouldn’t take more than a few minutes. Here’s how.

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.

5 of the Best Security Addons for Thunderbird

If you are using Thunderbird as your email client, check out this list of security addons for Thunderbird to secure your emails and protect yourself.

How to Opt Out of Facebook Browser History Ads on iOS, Android and the Web

Facebook is selling your search history to help advertisers better target you with specific products. If you are worried about your privacy, here’s how to opt out.

How to Add Confirmation Message Before Publishing a Post in WordPress

When you click the Publish button in WordPress, it turns the article live without prompting. To overcome this, you can get it to show a confirmation message before publishing.

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.

Todoist Review: Get Organized and Boost Your Productivity

Want to get organized and boost your productivity in the new year? Todoist can help and now is your chance to win a one-year premium subscription.

Easily Make Old Extensions Work with Current Version of Firefox

Sometimes, you are not able to install old extensions as they are not compatible with your current version of Firefox. Here is how you can force compatibility and make them run.