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 Read ODT Documents Inside Your Browser

Various web services can open Microsoft Office files with ease, but what about files created with LibreOffice? The good thing is, you can also read ODT document in your browser as well.

Temporarily Suspend a Tab in Chrome to Free Up System Memory

Do you often open a lot of tabs in Google Chrome, just to leave most of them untouched for hours? One way to prevent it from eating away your computer’s memory is to suspend the tab until you’re ready to use it. Here’s how to do so.

How to Quickly Close Multiple Tabs in Browser

There are times when you opened too many tabs in your browser and it is causing the whole system to slow down. A quick and easy way to fix this is to close as many unused tabs as possible to minimize the memory usage. However, it can be a chores if you have tons of opened tabs. Luckily, most browsers come with a way for you to quickly close multiple tabs with a single click.

How to Enable Two-Step Verification for Evernote

Add an extra layer of protection to your Evernote account by enabling two-step verification. A code will be sent to your mobile phone whenever you log in.

4 Ways to Embed and Email Web Pages to Your Friends

If you want to email web pages to friends, you can either send them the URL or use any of these 4 ways to embed the web page directly in the email.

Internet Censorship: How Countries Block Their Citizens from Entering Websites

Some countries carry out Internet censorship and block their citizens from entering websites. How do they do this? Here’s the answer.

What Is the OpenSSL Heartbleed Bug and Why Should You Care?

Things just don’t work the way they should in the Internet. Here are some things you should know about the OpenSSL “Heartbleed” bug and how it affects you.

Rid Your Site of Any Profanity Content with WebPurify

To get rid of profanity and offensive content on your site, you can either moderate every single post manually, or automate it with an external tool. WebPurity is one useful tool built for this purpose.

The Best Markdown Editor for Web

There are numerous tools for writing in Markdown via the web. We’ll be taking a look at some of the best markdown editor for web. Read on for more detail.

TunnelBear VPN: A Beautiful Bear That Just Works

Need a VPN service? TunnelBear VPN can encrypt your Internet connection while changing your public IP address to the country of your choice. Read on for the review and giveaway.

Protect Your Privacy and Browse Securely with HideMyAss VPN

HideMyAss VPN lets you access videos from any country, evade hackers and surf privately. Come read about all its features and enter to win 6 months free!

Top Places to Get Free Licensed Fonts for Personal and Commercial Use

Looking to expand your fonts library? Here are some of the top places where you can download free licensed fonts for personal and commercial use.