WordPress How To: Change Your Blog's Permalinks

I recently did the unthinkable. I changed the URL structure of my blog's URLs. Long considered a scary territory, along with moving domains, due to the SEO implications and potential for losing traffic, I was convinced by Bruce Keener to give it a shot. Ever since my blog launched I have been using the domain/year/month/day/post-name URL structure. I thought it was quite handy to know when the post was written before even loading it, but I ended up dealing with very long URLs that got quite annoying. In addition, it is known that if a random visitor from a search engine knows that the post they are loading is old, they are more likely to close the page quickly (to the point that some webmasters remove the date from posts entirely, or move them to the end of the post). Add to that how Google's own SEO expert Matt Cutts recently switched to the Thesis theme (which I'm using as well) and his permalinks do not include dates either.

The icing on the cake was Bruce Keener's comprehensive Case Study In Changing URL Structure where he stated that after the switch he did not notice any drop in his traffic, a result of Google PageRank immediately following the 301 redirects.

I had no loss of search traffic and loss of position in the SERPs for any of the URLs that I monitored during this time.

Going Dateless

That was enough for me to give it a whirl. I switched my URL structure to simply paulstamatiou.com/post-name structure as of last week.

Here are the quick steps that did it for me:

1) While this doesn't have to be the first step, it's important to clear your cache so changes are immediate once you do them and you don't have links using the old structure lying around. I disabled WP Super Cache while I was working, and then cleared the entire cache.

WordPress Super Cache - disable caching
WordPress Super Cache - empty cache
WP Super Cache plugin - disable cache, empty cache.

2) Change WordPress permalink settings. Select Custom Structure and type in /%postname%. It's up to you if you want a trailing slash. Click Save Changes. Your .htaccess might not not automatically update, but that's fine, we have to add some stuff to the .htaccess anyway.

Change WordPress Permalink Settings

3) Open up your FTP program of choice or fire up an SSH session. Navigate to the .htaccess file at the root of your blog's directory and add in the following line

RedirectMatch permanent ^/[0-9]{4}/[0-9]{2}/[0-9]{2}/([a-z0-9-/]+) https://paulstamatiou.com/1

after the RewriteEngine On line. Replace my domain with yours. Below you'll see what your completed root .htaccess file might look like (for simplicity I took out my other .htaccess and WP Super Cache lines):

<IfModule mod_rewrite.c>
Options +MultiViews
Options +FollowSymLinks
RewriteEngine On

RedirectMatch permanent ^/[0-9]{4}/[0-9]{2}/[0-9]{2}/([a-z0-9-/]+) https://paulstamatiou.com/1

RewriteBase / AddDefaultCharset UTF-8

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

NOTE: This RedirectMatch line assumes you have been using the domain/year/month/day/post-name structure. If you have been using some other form, it will need to be tweaked accordingly.

4) Save the .htaccess file and re-enable your cache. 5) If you're not already using the Google XML Sitemaps Generator WordPress plugin, now is a great time to start. Have it generate a new sitemap for your blog.

Google XML Sitemaps Generator WordPress plugin

6) Add your blog to Google Webmaster Tools. Make sure that the sitemap was accepted and keep an eye on crawl errors periodically.

Google Webmaster Tools Sitemap

That's it! Two weeks later my web traffic hasn't changed negatively and I'll wait a bit longer and report back about how everything works out in the long-run. Overall, the latest versions of WordPress (well it goes back to version 2.3 I believe) are pretty robust when it comes to their built-in redirection engine that can redirect all non-canonical URLs to the single canonical URL for the site. Combine this with a tried and true, SEO-tweaked theme like Thesis and your blog should be good to go.

Related: How To: Optimize Your Apache Site with Mod Deflate, The Importance of Permalinks

What URL/permalink structure are you using? Have you been a Google Webmaster Tools user for a while?

Like it? Tweet it.

"WordPress How To: Change Your Blog's Permalinks" by @Stammy

Get new articles via email