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.


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.

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\-/]+) http://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\-/]+) http://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.

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

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?
PaulStamatiou.com runs on the Thesis Theme for WordPress
Thesis is the search engine optimized WordPress theme of choice for serious online publishers. If you’re a blogger who doesn’t understand a lot of PHP, Thesis will give a ton of functionality without having to alter any code. For the advanced, Thesis has incredible customization possibilities via Thesis hooks.
With so many design options, you can use the template over and over and never have it look like the same site. The theme is robust and flexible enough not only to accommodate a site like PaulStamatiou.com, but also to enable the site to run far more efficiently than it ever has before.
Stumble This




{ 7 trackbacks }
{ 43 comments… read them below or add one }
One helluva good writeup, Paul.
The only negative I’ve seen anyone have with implementing this is when they went from a
site/year/month/postname structure
(rather than site/year/month/DAY/postname structure).
The problem he had is that the redirect rule treats his date-based archives as if they were posts:
site/year/month/page/2 (for example) is considered to be site/year/month/postname, so it redirects. Everything else works for such a setup, but I thought it worth a mention that folks who use a site/year/month/postname structure instead of site/year/month/day/postname structure need to be aware of this. (By the way, I recommend using Thesis or the All In One SEO plugin to add a noindex meta tag to date-based archives.)
I’ve not seen or had any problems at all in going from a site/year/month/day/postname structure to a site/postname structure. In fact, all indicators look positive for me. I should add we are entering a time of year when traffic typically declines, so anyone who sees a decline could be seeing a seasonal effect instead of a redirect effect. (I’ve not seen the seasonal decline yet, but Summer is historically a lower traffic period).
Excellent points you made in this post, Paul, as is typical for your thorough writing style.
I switched from /year/month/postname to /postname, and I’m having that problem with date archives.
Have you found any fix to this problem?
Same problem here, any fix?
Thanks in advance!
I’m not sure why but Matt at WordPress suggests using numbers after domain name before you use any other formats citing speed in accessing the pages as the reason. For e.g. it should be site/post-id/postname instead of just site/postname. I don’t know the reason why.
Yeah I’ve heard that before – easier to look up the id of a post rather than match the permalink then find the id. However, I’m not too worried about performance on my end. I have a beefy server. ;D
Yeah, the other concern being that WordPress has to check to see if it’s a page first, THEN a post. But if you don’t notice any issues… cool. :)
I changed my permalinks to just postname awhile back and have had no problems. I did it mostly because I like the clean looking URL.
Great write-up. I followed the same instructions after your tweet about it, and aside from the issue I’m having with dated archives, it’s been just fine.
A couple of thoughts for those having probs with the date-based archives (that is, those who used site/year/month/postname instead of site/year/month/day/postname).
The first thought is that date-based archives are almost useless. After discovering that less than 1 out 100 people would click on them, I stopped providing links to them several months ago. Also, since the search engines still see them, I use the All In One SEO plugin to add a noindex meta tag to the date-based archives.
Having said that, the archives do exist, and people who want to show them no doubt want a solution. One way to solve the problem is to format the date-based archive pages so they show as many posts per page as there are posts in a month, avoiding the site/year/month/page/2 thing altogether. This is something that takes some work, though, as the number of posts per dated archive page is normally the same as the number of posts per blog page. Someone told me that there is a plugin that will let you change the number of posts shown on date and category based archives: I haven’t found it.
In playing around with different themes, though, I have noticed that the Carrington Theme has a setting that lets you control the number of posts per archive page. The default setting in it is 25, but one could set it to some number that would exceed the number of posts done per month (say 50 or so) and rest assured that you wouldn’t run into the /page/2 problem.
I have tried to figure out how the Carrington theme does this, but the code is just above my head … it’s a pretty complex framework. The code is GPL, though, so if anyone could figure it out, you would become a coding god to the rest of us, and would this problem for a lot of folks who have converted from the site/year/month/post format.
Note that the Carrington theme is set up to show 25 (or whatever) posts by showing title, date, and number of comments only, which is a nice format for archives (and one that Thesis also allows).
That’s my answer then: Get rid of date-based archives.
Personally I use Joost de Valk’s Meta Robots plugin, but either way I get the noindex attributes.
Abraham, bear in mind that my former URL structure was site/year/month/DAY/postname, so I never ran into in problems myself with date archives, and therefore have had no problems in noindex’ing them. For someone whose redirects are not properly working though, and are borking the date archive paged pages, noindexing might not be the best thing to do, now that I think about it … what if it noindex’s the wrong page, for example.
My noindex comment applies to those who had a setup similar to mine (and to Paul’s), and might not apply to those who had a setup of site/year/month/postname.
Thanks for your concern and information, Bruce. I’ve checked the noindex attributes, and they seem to be appearing in the right places. On top of that, I’ve only recently started blogging in earnest (i.e. serious blogging, not the random mumbling I used to do – I’ve only yesterday started paginating on the home page ;), so I don’t have that much content to mess up, if I do. Originally, I was using the fully extended site/year/month/day/post format, which I kept for the first two posts, and then dropped in favor of the more “firiendly”/compact site/year/month/post. So I’m not particularly worried about losing my rankings or breaking links yet, but anyone with a somewhat considerable amount of content should probably think twice before switching. Thanks again, and thanks Paul for your writeup and other tips.
Good to hear, Abraham.
I also want to thank Paul again for his great detail on this. One of the reasons this is my favorite tech blog on the planet!
Bruce, I think the plugin you’re looking for is Custom Query String Reloaded.
Here’s a write-up I did on the plugin on how to show all posts in a category, same rules can be applied to archives, tags etc.
Adam, that is exactly the plugin. I remember the name now that you have said it. Thanks for the links, including the article you wrote!
I have been considering changing my Permalinks as well (I’m domain/year/month/day/post-name currently) to something without the date, but to be honest I like giving my users the ability to determine the date of a post before loading it. It may lose me some traffic, but not enough to move away from my preference.
Really good write-up though. If I ever change my mind and decide to switch, I’ll be sure to come back and read through this again.
Great post, Paul.
Wondering how can I have these rewrite rules re-written for the nginx!
nice post. i’m sure this info will be usefull for me
thanks paul- i’ve been seriously considering switching permalinks to get rid of the dates to make the older posts more evergreen, this post is giving me a bit more confidence. but i’m wondering if there’s a plugin or some other simple way to avoid editing htacccess?
changing the htaccess is the only way. any plugins you might come across end up changing the htaccess themselves, which might be dangerous having a plugin doing for you, especially if it were to have its own bug.
good job ;-) thanks
Worked beautifully and without having to use a plugin. Thanks!
I like this article, I am hoping to do a major overhaul to my website, moving the blog to it’s own domain name and changing the permalinks too. Now I have a primer for what I want to do, I just need to figure out the best way to go about it…
What a great article, and what great community participation! I’ve just started a new blog http://www.wordpress-for-beginners.com, and I used the typical domain/year/month/day/name format. Now I wish I hadn’t, for SEO reasons. This article is just what I needed to set things straight. Thanks!
Hi Paul
Thanks for the article.
I had changed the permalinks a few days before I saw your article, and used a plugin to manage it. It worked well with the posts. But, the pages in the wordpress blog has disappeared. :(
Do you know how to get the Pages back in action? (The static pages)
Btw, I had my permalink structure change from the domain/post-name to domain/year/month/day/category-postname because mine is a news website in a particular niche. For news websites, I think its always best to have the year/month/day format – it is important if you want your site to be in Google News.
Paul, many thanks for your article.
I’m also trying to create some pretty links.
Currently my URLs are like this: http://example.com/blog/archives/123 and I want to convert them to http://example.com/blog/post_ID/Post_name but I’m not sure what my RedirectMatch line should be as I don’t really undestand how it works in the first place.
Could you please give me some advice?
Regards
Spyros
Rewrite’s can be tricky, I’d suggest reading about them and then checking out a generator to get this done:
mod_rewrite RewriteRule Generator
Nice article.
The other reason why you might want to have post-id in your permalink structure as well is to avoid the possibility of having a duplicate URL.
In other words, over time, you may end up creating a post with the same title as a prior post.. but maybe Wordpress has a trick up its sleeve to get around that (I’ve not tested it).
Let’s say a year down the road you decide to do another switch, changing from /%postname%/ to say /%category%/%postname%/, how would you write the REWRITE rule for that?
I’m struggling with this problem now. I don’t want the redirect to take effect on my pages, but rather just my posts. However if my post’s are the same as my pages in terms of the slug there’s no way to differentiate, at least to my knowledge. Any ideas out there?
Thanks for the great post Paul
Thanks for your guide. I have very well understood how to do the custom setting. But I am afraid to make changes to the .htaccess file. Is there any other way do the redirection?
Great post. I fixed my site accordingly and it’s working great.
i finally did what i’ve wanted to do for a long time… move to domain/post-name, instead of lengthy domain/year/month/day/post-name
This comment was originally posted on FriendFeed
#How-To’s: WordPress How To: Change Your Blog’s Permalinks — PaulStamatiou.com: Author: Paul Stama.. http://tinyurl.com/lelcbb
This comment was originally posted on Twitter
@Stammy Nice post on blog structure http://bit.ly/ITFqO I’ve always wanted to move to WP from Typepad…might just do that now…
This comment was originally posted on Twitter
WordPress How To: Change Your Blog’s Permalinks — PaulStamatiou.com http://bit.ly/QSb4P
This comment was originally posted on Twitter
WordPress How To: Change Your Blog’s Permalinks — PaulStamatiou.com http://bit.ly/QSb4P
This comment was originally posted on Twitter
WordPress How To: Change Your Blog’s Permalinks – http://tr.im/prHm via @Stammy #wordpress
This comment was originally posted on Twitter
WordPress How To: Change Your Blog’s Permalinks – http://tr.im/prHm via @Stammy @shivaranjan
This comment was originally posted on Twitter
Just fixed the permalink structure on @DidntYouHear thanks to @Stammy’s fantastic guide: http://bit.ly/Logft
This comment was originally posted on Twitter
WordPress – How To Change Your Blog’s Permalinks – http://tinyurl.com/lelcbb Great Post By @Stammy #wp
This comment was originally posted on Twitter
WordPress How To: Change Your Blog’s Permalinks. http://bit.ly/lFQlz #ums
This comment was originally posted on Twitter
@naontiotami @podblack here’s a post on it http://bit.ly/3AsAvL
This comment was originally posted on Twitter