How to change your WordPress Permalink Structure

change WordPress permalink structureQuite often I give people the advice to change their WordPress permalink structure, this post details the why and, more importantly: how to make such a change without losing the traffic that you already have.

It includes a new tool built by yours truly to help you create the necessary redirects. Keep on reading!

Why change your WordPress permalink structure?

Most of the time I tell people to change their WordPress permalink structure, it's to get rid of the dates in their permalink structure. If their content is "timeless", it just shouldn't be there. In my opinion, the only type of site that should have dates in their permalink structure is a news site. All other sites should strive to write content that is "timeless".

Having a date in your permalink structure has proven to diminish the CTR from the search results for older posts. People are just not likely to click on a result that's two years old, even though it might very well be that your post has the answer they seek. With Google seeming to use that CTR more and more as a (very valid) ranking signal, that's becoming a more serious factor each day. I did a long post on WordPress SEO URL / Permalink considerations a while back, you might want to (re-)read that.

Performance considerations

Up until WordPress 3.3, there was / is indeed a quite serious performance issue when you have a lot of pages when you use just /%postname%/, luckily, that is solved in WordPress 3.3. I have debated people quite a bit saying that it's easily solved with some caching but having it fixed in core is a big step ahead, so there are no more excuses to not use /%postname%/.

Changing WordPress Permalink Structure

There are two steps in changing your WordPress permalink structure. The first is simple, go to Settings -> Permalinks and select Post name:

WordPress Permalink Settings

Change your WordPress Permalink Settings

If you don't have the post name option yet, you're not on WordPress 3.3, the release of which is imminent. You could wait a bit for the update, or you could just add /%postname%/ as a custom permalink structure.

The second step is to redirect your old permalinks to your new ones. To do that, you have to add redirects to your .htaccess file, I have created a little tool that generates these redirects for you based on your domain and your old permalink structure. To use this tool, click the button:

Generate Redirects

There you have it! If you copied the redirect into your .htaccess, you should test whether it's working. If it's not, chances are you're not allowed to use RedirectMatch, which makes changing your WordPress Permalink Structure a bit harder and not something I can easily cover in this post.

Let me know whether the tool works for you and what you've done to your permalinks!

Tags:
Category: WordPress
You can skip to the end and leave a response.

182 Responses to “How to change your WordPress Permalink Structure

Thanks for building the redirect tool Joost! Question... does it matter if the site is on shared hosting? If so, should I be entering the root domain as the primary, then the actual site in the "folder" field? Would I then edit the .htaccess file for the root domain or the .htaccess file located in the target site directory? (Hope that made sense!) Thanks for all you do... love your stuff!

No, just enter the URL to your site, nothing else there. Make sure the redirect is at the top of your htaccess file!

I think I know where you're confused. You modify the htaccess file used by wordpress. For instance, I just changed http://www.ballstateballroom.org/v1/ from using /archives/%year%/%monthnum%/%day%/%postname%/ to simply /%postname%/. I added the generated code to the htaccess file in my v1 folder (though it should also work if placed in the htaccess file at the document root).

This will work even if your site is located at blog.yoursite.com or lots.of.subdomains.yoursite.com, just so long as you put the url as you see it in Joost's domain input.

Hi joost, do you think it's better if you use the /%postname%/ structure or the /%category%/%postname%/ structue?

I suppose domain.com/category/article is better as user has the idea of hierarchy and he can explore domain.com/category for more similar articles. I have implemented this in my site Gtricks.

This largely depends on if you'll have more a post in more than one category at any given point. As a user, I'd like to see something like this, but from practicality's standpoint, it isn't as flexible I'd like it.

Cheers for the plugin, should be very useful in the future

I'm currently on Caregory/post-name - what do you think of that structure? Any pros/ cons over post name alone?

Colin

Depends... If your category slugs are short and descriptive it's sometimes a good idea to add them.

Hey Yoast - Thanks for the post. Question related to this subject. I was also using /category/postname and utilized the steps you mentioned above. Now my category pages aren't working. I'm getting 404 errors on them and single posts, rather than the list of posts within that category. Any insights?

From the wordpress codex:

"For performance reasons, it is not a good idea to start your permalink structure with the category, tag, author, or postname fields. The reason is that these are text fields, and using them at the beginning of your permalink structure it takes more time for WordPress to distinguish your Post URLs from Page URLs (which always use the text "page slug" as the URL), and to compensate, WordPress stores a lot of extra information in its database (so much that sites with lots of Pages have experienced difficulties). So, it is best for the first structure tag to be a numeric one, such as /%year%/%postname%/. (Some people recommend /%post_id%/%postname%/ which works for performance reasons but others recommend against it because it is unfriendly to users in the many contexts in which users interact with URLs.)"

You know Travis, when you respond, it'd be nice if you actually read the article :) Those performance issues are solved in WP 3.3.

added the line generated for the htaccess, and images uploaded through wordpress (in wp-content/uploads) no longer display.

What line did it generate for which input?

month and name

RedirectMatch 301 /([0-9]{4})/([0-9]{2})/(.*)$ http://nerve.yourbro.com/$3

Good point, just updated the generator so please re-try, the output should now be:

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://nerve.yourbro.com/$3

thanks, works now

^ Am I the only one who sees no difference between Joost's changes and the OP's generated code?

Btw, that update makes it un-break the images ;)

Just a question: Do I really have to edit htaccess? Isn't there a nice internal 301-redirect if post names match?

In most cases WP redirects internally, not in all cases though. Also, htaccess is WAY faster.

Thought so! Thanks for the quick answer!

Hi,
This is awesome. Thanks.
Actually I have been using the /%postname%/ custom structure on one of my sites for most of this year. I had no idea about the performance issues but I knew that the date in the url might discourage some people from clicking on it despite not being relevant.
What kind of performance boost can I expect?

Depends entirely on your server, how many pages you have and some other vars, so hard to say.

Thanks Yoast - this sounds great - one question I have is how this will interact with internal redirections. We use the Redirection plug-in to do some 301 internal redirects. Just wondering how the .htaccess changes will interact with this.

These .htaccess redirects will be read before Redirection is even activated, and if they didn't redirect, Redirection still can, so you can use both at the same time without any issue.

Thanks for the reply - one other question - are postnames in WP always unique? Just wanted to make sure as I didn't know if over the years I had doubles of the same postname. I don't think so (I think I remember it trying to add a 2 or a 3 to the postname in later posts).

They are, yes, if you use the same post slug twice it'll add -2 to the end of it.

Hi Joost,

I migrated from All-in-one-SEO pack to your plugin and ever since, I have lost Google ranking, even though I have worked hard on all the General and Page Analysis details supplied with your plugin (all green ticks). Can you tell me what may have caused this loss rather than gain in page ranking?

Thanks Joost,
Robin

You probably did something wrong :) Did you change permalinks without checking the redirects? Also, was there a specific date on which you lost traffic?

I probably didn't do the redirect thing. Are you able to help me there? Can you offer a service to check my site over? I am publishing two more books on January 1 2012 and would love to get my ranking back. Thanks Joost for your quick reply.

Robin

Hi Robin, I'll contact you via email :)

I too migrated from AIOSEO to headway themes SEO to WordPress SEO by Joost......doing so got rid of a duplicate content issue.....and my rankings are going UP UP UP
Im a newb ...and this site has done nothing but help me succeed with my website endeavors....thanks Joost!

I did this and suddenly my traffic dropped from over 10,000 to under a thousand. What did I do wrong???

You forgot a redirect? Or you did it wrong somehow? Are your old links properly redirecting to your new ones?

How do you check to verify that your old links are properly redirecting to your new ones? Is there a screen print you could offer? I use the Redirection plugin by John Godley but I'm not sure I'm using it correctly.

The easiest method I've found is to copy the link to a post before I change the URL, change permalink structure, add Joost's redirect code to htaccess, then paste the old post link into my location bar.

If it's working, you should automatically directed to the new post's location. If not, i.e. 404 error, start troubleshooting.

Yoast,

I've always been a fan of the /%post_id%/%postname%/ structure so that if I ever want to change the name/slug of the post, I don't have to worry about redirection/404 errors, since the post id is still intact. What is your opinion on this structure?

I think you might get problems with that structure if someone makes a typo in the link. Cause in that case, you will get duplicate content.

That's not true Erik, WordPress would redirect to the correct one.

Ok, clear. In that case, I guess I'm gonna try the /%post_id%/%postname%/ structure :)

Well Seth, it's really up to you, depends a bit on how many posts you have whether it's actually worth redirecting, I doubt it, to be honest.

Thanks Joost,

I've got about 50 posts on one site, and 400 on another. I'll probably stick with the same structure for those two for the time being, but may try it out on another site with less posts.

Joost, if i had several permlink changes before - did it has impact of pageload speed?
At first it was /%postname%/, then I have red about performance issues and changed it to /%year%/%postname%/
Now site is restructured to have several categories and it would be nice to have /%category%/%postname%/ structure. How it can influence site spoeed and google ranking?
Thanks!

If you didn't redirect them properly you might have lost some traffic...

But how about site perfomance if I change permlink structure 2nd/3rd or more time?

Pay Attention to the .htaccess redirect in WordPress cause some time WordPress or other plugin like w3 total cache reset the file to it's original...so you loose your .htaccess rule.

Use virtualhost file to write redirects if you want to keep them safe.

That's not true for W3TC Andrea, it'll add stuff to the .htaccess but it won't write a new one or delete stuff, nor does WordPress itself. You've probably done something wrong yourself, to be honest, or another bad plugin did it...

No other plugin Joost...only w3tc installed, and I made various tests.

I doubt it :) Something must be going wrong there, but if you did several tests, have you submitted a bug to Frederick?

It's so simple to test an .htaccess issue :) I have no doubt.

Erm, that's not exactly true Joost. I have reported this already to Fred on Octover 28th and the last I heard is he's "looking at it". It had been happening for several weeks on one of my sites and while I am not affected by it at the moment (redeveloping that site offline), it is a known feature of that last release which was't resolved by the then development version.

Hi Joost, thanks for the work on this. How would I redirect from /%postname%/ to /%category%/%postname%/ ?

You'd let WordPress handle that, unfortunately there's no way of doing that with .htaccess because Apache doesn't know which category your post is in.

How about changing domains? I have this in .htaccess but have lost all my se traffic. How long before i get it back and will it all come back?

# Use PHP5 as default
AddHandler application/x-httpd-php5 .php

# Added per GKK-16659785
Options +FollowSymLinks
RewriteEngine on

# Redirect all pages from olddomain.com
# to newdomain.com
RewriteCond %{HTTP_HOST} ^www\.wordpresssites\.net$ [OR]
RewriteCond %{HTTP_HOST} ^wordpresssites\.net$
RewriteRule (.*)$ http\:\/\/www\.wpsites\.net\/$1 [R=301,L]

I can sit back and not worry about this... Our permalink structure was changed last year following guidance from your Website REVIEW Report!

Good :)

Well i had already changed my posts permalink structure to /%postname%/ so no issue for me, thanks to your previous article, Joost :D

Worked like a charm. Thanks as always, Joost!

Great article!

I personally prefer /%post_id%/%postname%/ - which allows me to adjust the post name / URL without breaking anything.

I found it strange that after so many versions, that it took until WordPress 3.3 to insert the postname permalink structure as an official option. I now have to update my own screencast on changing permalinks.

Heh if it were my choice it'd been fixed ages ago indeed :)

Joost, you're a legend! This worked brilliantly, so thank you. I'm still a newbie to WordPress but I must say I really like your blogs articles and plugins, I use both your WordPress SEO and Google Analytics plugins and have also followed previous posts about setting up the social buttons. Your writing is clear and your methods work and hit the nail on the head especially with me and how I want my site set up! Thank you!

My pleasure. If needed I can point you in the direction of my donate button :P

Donation made! Keep up the good work..! Cheers Mark

Stop that, his head's big enough already.

Nothing worse than a Dutchman with a big head. Except perhaps two of them... 8^)

@Joost - Okay I'll sort something out this week! Got the hint haha
@Terence - Haha, Well credit when credits is due... Okay well us Brits need all the friends we can get in Europe now!

Thank you very much for the post really helpful. I've finished editing the htaccess and you've said to test it out - which believe it or not is where you've lost me.

How do I go about testing the old permalinks.

Again thank for everything you do from your plugins to these beautiful how-to's.

Thanks,

Jesse

Joost, thanks for the helpful RedirectMatch tool. You might want to correct the following example used for 'Your old permalink structure':
from
Month and Name /%year%/%monthnum%/%day%/%postname%/
to
Month and Name /%year%/%monthnum%/%postname%/

The example was wrong indeed, thanks, I fixed it. Luckily the redirect returned was ok :)

My problem with this is something entirely vain but perhaps (?) easily fixable?

I tried doing the permalink change once before and wanted to stick with it - but I LOST all my social sharing numbers - all that social proof went out the window.

I was just vain enough to really NOT like that. *grin*

@Joost - do you know of any solution that will take care of this and is easy enough for a relatively new coder to do?

No that is indeed a very genuine problem, especially with Twitter. I think Facebook will follow the redirects...

Having the same issue here... :/

Unfortunately, during my limited trial run of this a couple weeks before you made it so much easier *grin* Facebook and Twitter both lost them ... I found a workaround by another coder that involved changing the code but I just wasn't well-versed enough in my old code to take advantage of it. I might try it again - I can always change it back it need be. I will post the link here if it works. :-)

So, here's the link to Encosia, where Dave Ward tackled this problem ... I am still muddling through the code, but I wonder, @Joost, would something like this be hard to write into a future version of your amazingly simple WordPress SEO plugin?

The link: http://encosia.com/preserving-social-sharing-counters-through-a-url-change/

I'm very curious to see what you think of this technique as well!

Thanks for the link Katrina!

Although, only a master coder like Yoast to show us some light...

I know - I hope he'll weigh in on this ... I would love to consider trying it again *grin*

Well all I can say is thatñ Joost you did it again!!! Great job!! I have almost all of your plugins installed in all my sites (quite a few) and you are always on top of everything. Sites are working like a charm.

Hi Joost,

I am running on the configuration below.
WordPress Version WP 3.3
PHP Version 5.2.17
Server Software Apache

Plugin
WordPress SEO v1.1

When I publish a job, I get this error.
WordPress Version WP 3.3
PHP Version 5.2.17
Server Software Apache

Warning: sprintf() [function.sprintf]: Too few arguments in /homepages/19/d358194680/htdocs/wp-content/plugins/wordpress-seo/admin/linkdex/linkdex.php on line 175

Any ideas how I may fix this?

Thank you,

David

Fixed that in 1.1.1, please use the support forums for support, not my blog post comments :)

OK, I've read several tutorials but I seriously can't get my titles to work right. Yes, my header. php has , but here's what happens: If I don't click on "force rewrite rules" the site name appears doubled.

If I DO click on "force rewrite rules" then the only titles that display correctly are pages and categories. Posts don't show the site name, and - here's the crazy part - the homepage title has a category (Film) before the site name!

I imagine this has something to do with the fact that I'm using a custom theme (Rich WP Magazine) that came with its own SEO? At any rate, please help ...

I meant "force rewrite titles", not "force rewrite rules", but you probably figured that...

I have tried it at http://moonramkonam.com and it works like a charm. Only issue is, as I am using mod rewrite for my Super Cache, will this affect my cache performance?

Hi Joost,
Your tool has an option for "Old permalink structure" called "Month and Name" which looks like this:
Month and Name /%year%/%monthnum%/%day%/%postname%/
WordPress doesn't include /%day% in their path. Does this discrepancy affect the performance of your tool?

It was wrong indeed (and fixed now), the redirect generated was OK though.

Hi Joost

I've inherited/help other folk out with WordPress sites that have always used Permalinks which include the date in them either before or after the postname. I'd love to move them to a clean postname structure but isn't there a risk of losing some of their authority, particularly the older ones, if you switch URLs?

I know redirects should save any 'juice' from links to the old URL but I seem to remember some old SEO sage saying that changing URLs will mean you lose a bit of the history of that page so you are likely to get knocked back a little in SERPS.

My ideal would be to change the Permalinks for new posts and leave the old ones alone. Is this possible?

Cheers

Chris

Hi Chris,

unfortunately there's no real good way of keeping old permalinks and switching to a new structure for the new ones... There are some plugins that claim to do this but i've always found them to at best half work.

Is there any way to save your Facebook Likes after moving URLs?

I think Facebook will catch 301's, but not 100% sure.

In my case, FB didn't.
But maybe it needs some time until it went through all the FB servers. I will report back in a few days.

Hi Joost,

Seems like a very useful tool but it does not work for me: when i submit, i get redirected to this page, and there is just nothing produced by the form that appears anywhere. Tried on Chrome and Firefox 8.0.1 (mac os x lion).

Thanks!
a.

Hi Alexandre,

thanks for the notice! I replaced fancybox with colorbox and apparently made a mistake, fixed now :)

Works great now, thanks!

I was just wondering what might happen if 2 or 3 years later a post is created with the same name (URL) i.e.

http://www.example.com/latest-wordpress-tweaks

Then say 3 years later you make another post with the same name, what happens then? The old method makes sure no two URL's are the same, will WordPress just ask you to change it?

WordPress will detect the duplicate slug and automatically add -2 to the end of it.

Have a similar question. What if you already have posts with duplicate titles? Removing the year and month from the URL will mean two different posts with the same URL. How would WordPress know which post to display? I suppose I would just have to go and rename those posts to make them unique.

Question on Permalinks and Google News, that I am hoping that you might be able to shed some light on. Is it possible to be able to add the required 3+ numbers to just one category or to the blog while maintaining say /%postname%/ on the rest of the site? without too much brain damage...:)) trying to maintain present site structure and also get some love from Google News.... appreciate any direction....

If you have a Google News XML sitemap, as generated by my News SEO module for my WordPress SEO plugin, you don't need those 3 numbers.

Joost,

Google recently announced ten new algorithm changes to the way it displays and ranks search results. Danny Sullivan outlined these change and explained what he thinks we need to know.

I would be very interested to hear your comments and how, in particular, it might effect the immediate (or otherwise) development of WordPress SEO plugin, and SEO in the long run, i.e. from here on out. Since I rely on your knowledge and some of the software you write, I would like to know.

1. Better Snippets – Defined as the descriptions that Google shows for Web pages, snippets will be greatly improved because this text will now be selected from the main content on a Web page instead of from headers or menus

2. Application Rich Snippets – Google will start showing rich snippets for software applications that will provide more details within their search results. These application rich snippets will be also available to users more frequently.

3. Improved Page Titles – When creating page titles, Google will now place less emphasis on anchor text in order to enhance their relevance.

4. Ranking Boost for “Official Pages” – Google will strive harder to detect which pages are actually official, which will result in higher rankings for these official websites.

5. Much Fresher Results – In a move affecting up to 35 percent of total searches, Google’s improvements in ranking fresh content will better decide the level of freshness for each inquiry.

6. Enhanced Results for Date-Based Searches – The freshness of results will now also be determined by date to offer an additional degree of relevance.

7. Elimination of an Image Search Signal – Now, images that had references from multiple documents on the Internet will no longer be a factor in image search.

8. Greater Cross-Language Information Retrieval – Previously done only for the Korean language, Google will now automatically translate relevant English Web pages for the languages of Welsh, Slovak, Swahili, Hindi, Norwegian, Serbian, Catalan, Afrikaans, Maltese, Macedonian, Albanian, Slovenian, Icelandic, and Malay.

9. Improved Autocomplete for IME Queries – Google has improved the way that Autocomplete responds to queries containing non-Latin characters so results are no longer muddled for Hebrew, Russian, and Arabic languages.

10. Better Autocomplete for Russian Language – Russian query predictions will no longer be as lengthy or random as previously.

With these changes, obviously Google hopes it will further strengthen its search supremacy through results that deliver higher quality for every query. That's all very well for their business plan, but of course, I only care about how it effects the searches for the stuff I have on my sites.

Terence.

Hello Joost,

Did you not (a) see my post on Google's algorithm changes, or (b) are you ignoring me (grin), or maybe (c) it's just taking a while to formulate a very detail and well considered answer? (even_bigger_grin).

Also, I just did some testing while I was waiting and the P3 Plugin Performance Profiler from GoDaddy tells me that, of the 17 active plugins I have on this site, the WordPress SEO plugin is taking 0.0206 seconds to load, which is 45% of the page load runtime.

WordPress Plugin Profile Report
===========================================
Report date: Fri Dec 16, 2011
Pages browsed: 10
Avg. load time: 1.4109 sec
Number of plugins: 16
Plugin impact: 3.25% % of load time
Avg. plugin time: 0.0459 sec
Avg. core time: 1.1060 sec
Avg. theme time: 0.1540 sec
Avg. mem usage: 22.45 MB
Avg. plugin calls: 1,807
Avg. db queries : 20.10
Margin of error : 0.1050 sec

Plugin list:
===========================================
Akismet
Buffer Button
Conditional Widgets
Headway Html Sitemap
Headway Navigation Leaf
Html On Pages
Newsletter Sign Up
P3 Profiler
Shortcode Generator Menu Dropdown
Si Contact Form
Simple Urls
Slimbox 2 Slideshow
Tinymce Advanced
Wordpress Seo
Wysiwyg Widgets
Xcloner Backup And Restore

Is there anyway to speed WordPress SEO plugin a lot, or even a little?

Terence.

Hi Joost.
I am not sure what this issue is caused by but ever since I updated to your new SEO Plugin update for WP 3.3 my posts links seem to be broken.

The address in the address bar for some posts instead of having http://www.domain.com/postname format shows http://www.domain.com/?attachment_id=887

I also get the following browser error message.

The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

This problem can sometimes be caused by disabling or refusing to accept
cookies.

How is this fixed as some posts are not accessible ?

This is not a support forum mate, please take it to the wp.org forums and do share your real domain name or i won't be able to help.

Joost can you please hop over to the WP Support forum and help us out as our site is still in shambles as we await your advise on the above issue.

We need help as our site links do not function even if we disable this udated SEO plugin. Everything worked well before we updated the SEO plugin on our WP 3.3 installation.

Again my apologies for coming back here but we posted the issue in the WP forum and I do not know if you saw it.

a link to our Homepage is also there

http://tinyurl.com/3jyjafo

Hey Joost - Thanks for the post. I was also using /category/postname and utilized the steps you mentioned above. Now my category pages aren't working. I'm getting 404 errors on them and single posts, rather than the list of posts within that category. Any insights?

What's the redirect it generated for you?

RedirectMatch 301 ^/([^/]+)/([^/]+)/$ http://www.michaeljbarber.com/$2

From what I understand of regular expressions and htaccess syntax, you're redirecting /text1/text2/ to /text2/. What this means is /category/foo is being redirected to /foo/, which wordpress does not understand.

In short, this fix will not work with redirecting from /%category%/%postname%/ to /%postname%/. It's a limitation of htaccess. Instead, just let wordpress do its thing and automatically redirect it. Slower, sure, but at least it works.

... Actually, it's not pretty but there is a way to use htaccess redirects in your case. It involves ignoring a list of reserved words (i.e. category slugs) and regular expressions. The folks over at Stack Overflow may be able to help with that one, if you're willing to put in the effort.

I wanted to change this since a long time. Thank you Joost for this great tool. I changed the structure within 5 minutes and it works without any problems!

I have been trying to redirect my links since moving from Tumblr to WordPress and I even brought in some of my coding buddys but none of us could figure out the proper regex method. THANK YOU THANK YOU THANK YOU!

sorry, I was not yet really understand about the contents of the paragraph entitled "Performance considerations". you mean the WP V3.3 performance for /% postname% / is fixed to make it faster? or do you mean, still depends on the plugin cache and the quality of the hosting server?

Thanks for the nice post anyway...

before i do anything.?? when you have you website blocked in the htaccess file by the hosting company because the use of the server is to higth do it to traffic,and i move to another hosting and transfer al you conteng,still htaccess is blocke and need to be remove on the file.??

If you do not have access to htaccess files, it's not a big deal. You'll take a hit on performance, but wordpress does have a redirect function built-in. Although far from perfect, wordpress is supposed to automatically redirect the old permalink structure to the new one as soon as you switch it in the settings. It's not nearly as fast or as efficient as using htaccess though.

To Alla, mate helping you is hard when you type like that. I could barely understand it.

I didn't know this was SOLVED in WP 3.3, going to update now then :)

Awesome news, this really is. I used year due to performance reasons as well.

Hi Joost,

This is great advice; I only ever include the date in my URLs if I want a chronological timeline for my posts. But on most of my blogs I follow your advice and write evergreen content.

But a have a question: is there any compelling reason to include the trailing slash in the URL? I use a custom structure: /%category%/%postname% with no trailing slash. What's the advantage of the extra slash at the end?

Thanks,
Graham

Hello...

I am currently using the 'Redirection' plugin with the standard default structure (/?p=123). Can I just change the permalink structure to the Post Name structure (/sample-post/) and the redirection plugin will handle the 301's and redirect automatically to the new structure?

You don't even need the redirection plugin for that, WordPress itself will do that for you.

Thanks Joost. I'll give it a try tonight.

Thanks for the quick reply :)

It works!!!

I can't believe how long I have been researching this thinking that I would have to do alot more than one click

Thank you very much :)

Need some help!

1. If my old permalink structure is - /%post_id%-%postname%.html, how do I redirect it to this (new permalink structure) - /%year%/%monthnum%/%day%/%postname%/

2. Where can I learn more about these, so that I can write more complex redirection? (I have tried, but no source was clear enough.)

Thanks.

1: you'll need WordPress for that in part, so redirect to ?p=%post_id% first by doing this:

RedirectMatch 301 ^/(\d+)-([^/]+).html$ http://example.com/?p=$1

(be sure to replace example.com)

WordPress will do a second redirect for you.

And does my second question look silly or out of topic? :(

(Thanks for the quick reply.)

No just search for RedirectMatch in Google :D

Hmm... I will give it a good try now again. And by the way, the redirection code worked like a charm. Until now I had to depend on Dean's Permalinks Migration plugin for the same. Thanks for that.

Also, the notifications reached my inbox! That rarely happens when I subscribe to a post's comments on another website. Kudos for that. Yeah, I just read this article of yours. =)

Take care.

I have a question about Permalinks and SEO as it pertains to Custom Post Types & Taxonomies. I haven't seen anyone of the SEO experts comment on the use of Custom Post Types and how it might help or hurt your SEO efforts. Any suggestions or Recommendations?

Pingback: How to Go From Suck to Unsuck

Hi Joost, very interesting post but unfortunately it didn't work out for me. I changed the link structure to http://www.paulolyslager.com/sample-post/ and included RedirectMatch 301 ^/([^/]+)/$ http://www.paulolyslager.com/$1 to the htaccess file but received the following error message: Fout 310 (net::ERR_TOO_MANY_REDIRECTS). I deleted the htaccess rule and changed the link structure back to /%POSTNAME%/ but this doesn't seem to save in WordPress. Any solution you might think of would be nice!

Hi Paul, so what structure were you on and what are you on now?

Thanks for the reply. I wanted to change the structure back to its original state, Custom Structure: /%postname%/ , but saving changes doesn't seem to work. Maybe this is a bug in WP because on top it states "Permalink structure updated", but the radiobutton is stuck with "http://www.paulolyslager.com/sample-post/". That is why I'm not really sure which structure I am on for the moment. I also deleted the .htaccess line.

Also, is it possible to have lost all the Facebook Likes and Google+ for each post after changing the permalink.

After implementing your recommendations for changing my permalink structure, my page load time improved but I lost the links to my tags. I have a news site so I focus on topics that are current. For example, in my menu I have an option called "Occupy". It is linked to htt://www.laprogressive.com/tag/occupy

When I after implementing your recommendation, that url stopped working. Is there a work around for that?

Thanks for posting such helpful info regarding permalinks.

P.S. what Custom permalinks structure you prefer the most?

It seems, that Facebook doesn't support 301 (to prevent fraud). I found this article: http://facebook.stackoverflow.com/questions/3823676/is-it-possible-to-force-facebook-likes-to-follow-301-redirects

But I don't know how to do the url rewriting.
Any ideas?

I run a couple of podcast sites I host myself on a dedicated server. A few years ago when I started this project, I had no idea about permalinks or anything, so I left it default. Now I see that it would help with SEO if I had used a custom permalink structure. On one site we have over 500 episodes / posts, all using default permalinks, on the other we just hit episode 100. We get decent search hits and everything because of how I write show notes and title my episode names, but my question is, is it worth it to change the permalink structure or is it not worth it at this time? I have been using a basic redirect script to make it easy for people to find my pages. For example, if you type in thejamhole.com/live to hit our live show page, i have a folder in the root called live, and inside is an index with a simple javascript redirect. If i was to change permalinks, will I have to completely redo all of those? Is it best to just leave things be? Curious what you think. Thanks for a great plugin!

Hi Joost, thanks for the informative article and the Generator tool.
As I have understood that you work closely together with Amir of WPML, what is your advice regarding the permalink structure for sites running WPML? Their advice has always been to use year/month/day/postname otherwise WPML doesn't function. Has this changed perhaps with WordPress 3.3? Any insights would be much appreciated.
Thanks,
Piet

Hi, Joost! I found this article very useful. FYI, I'm an extreme newb and fearful of making these kind of changes to my site. I have perhaps 40 posts/there and am using WordPress 3.3.

Using your instructions, I changed my permalinks from the the basic default number style to a custom /%category%/%postname%/ structure. It seemed to work fine. However, when I ran your .htaccess utility, it gave me this response: "You don't have to do any redirects, WordPress will do it for you"

That's contrary to what I expected, based on your article yet my preliminary tests indicate this is true. Is this normal?

Thanks!

Hi Joost, A bit of a newbie at this backend stuff I changed the format without implementing the redirect code! Have changed the format back to day and name in the meantime.

I was getting a lot of 404 errors in search results. Trouble is i have no idea how to >Add the following redirect to the the top of your .htaccess file:<
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://www.smartmoviemaking.com/$4

as I cannot find the .htaccess file?
I'm running latest version on wordpress on dreamhost - do I have to add it there?

confused, please help!

Thanks

Tony

Joost! I have a serious problem, all my posts are coming up with error 404 messages - please can you help, at a loss what to do.

Please get in touch.

Thanks

Tony

Tony

Issues resolved, web hosting company told me where to find .htaccess file, and I must say it works like a dream.

Thanks for this.

Tony

Hi Joost! your plugin has been rocking all around ever since I started using it months ago. I have one question, which you've probably been asked to many times:

is there plans to bring in permalinks editing functionality to your plugin? I am after removing the trailing forward slashes from WP blog 'pages'. Any ideas for that?

yoast is the best, thank's Joost

Hello this is the first time left my comment in this monster WP optimization site.

My question is i use permalink /%category%/%postname%.html

How can safe redirect without lose ringings to /%postname%/

many thanks keep doing that great job!!

Q: Is there a way to keep all old post URL structures the same, and start a new structure going forward?

The reasons for this are twofold: I have a news site and my current structure is /%category%/%postname%/ . You cannot be listed in Google News unless you have 3 digits in your URL. However, I have a ton of posts on my site dating back >3 years, with a lot of social signals pointing to them that I do not want to lose.

I want to essentially start fresh with a new post format.

Is this possible?

you can use a sitemap, so you can't use 3 digits in url

Thanks for posting helpful info regarding permalinks. i changed according to your suggestions..

There is a problem with "generate redirects" tool,
with old structure as /%category%/%postaname%
RedirectMatch intercept also /tag/tagname,/category/categoryname and /page/#pagenumber

there is a solution?

I'll rephrase my question as I dont think it was clear:

does anyone know how to edit permalinks for WP blog 'pages' specifically (not blog posts)? I am after removing the trailing forward slashes from WP blog 'pages'. Any ideas welcome.

Hi Joost,
Thanks for posting this. I have realized in the past day that my initial choice of Day and Name permalink was not ideal. Further, I chose a website name in the hope of minimizing typing errors and skipped the most important word in the title - the name of my town (I am a photographer and focus on shooting the town of Marblehead).

Before I proceed, I used your generator and got this:
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://wednesdaysinmhd.com/$4

This was to redirect to /%postname%/

I think (and please correct me if I'm wrong) that the ideal for me would be:
wednesdaysinmhd.com/marblehead/category/postname

Can you give me your thoughts on this? Can you please help me understand how to alter the redirect generated above? Would I use that line and then put in the above as a custom permalink (ie: /marblehead/%category%/%postname%/)

Thank you very much!
E

ps - very happy to made a donation if this works. I've spent several hours researching this topic and this seems the 'cleanest' approach

I've done it well on your recommend. Thank you. None of things damaged.

At first I clicked on your "Generate Redirect"button.Then my web not on sub domain so I filled in my url and chose "Month and Name /%year%/%monthnum%/%postname%/" that's my past settings in permalink.Generate and got the code that I kept it to post on top of .htaccess. Second I change permalink as you recommended. It's OK.

I just found that http://mywebsite........is unreachable. at the end of every posted. How could I fix it?

I thought it about facebook comment that it show me how to fix on Object Debugger at developers.facebook.com. So I would try to fix it first. Thank you to you again.

Hi Joost, I changed my permalink structure from default to custom postname and now I can't access any of my content. My home page shows but I get a 404 when clicking any content. I've tried your fix here but it did not work for me. Are you able to point me in the right direction? I've spent hours on this with no movement. I can't even access new posts that I publish.. peace, Shayne.

Hi Joost, ok update. The permalink change works for posts only. Not for portfolio items. Portfolio items give a 404. How can I get portfolio items to work with the new post-title permalink structure? Regards.

Hiya, I figured out a work-around but it's not ideal. I have to do a 301 redirect on every portfolio post. I edited htaccess by adding this to the end. There's an entry for each portfolio post. Keen for your thoughts after the Christmas festivities. Peace.

#to redirect urls from old to new urls
Redirect 301 /portfolio/ http:///?portfolio=

Any reason to change my current permalink of /%postname%.html ?

Thanks!

Will changing my permalink structure after say i have published posts or pages cause broken links. Or will wordpress simply redirect the changed links?

I just changed mine from the standard structure to post-name. WordPress will automatically change the structure and create 301 permanent redirections on all your existing links.

The only short term problem you will have is that Google will begin noticing duplicate content on your site... This should go away once it has done a full crawl of your site.

I changed mine from the custom structure of category/postname to postname. It seemed to work like a charm but then I had a problem with my tags. I have a news site so I focus on topics that are currently in the news. For example, in my menu I have an item titled "Occupy". It is linked to http://www.laprogressive.com/tag/occupy
After changing the Permalinks, that url goes to my 404 error page. I've asked for a work around but I haven't heard anything yet. So I changed my Permalink structure back to he way it was before I read this article.

Joost, simple tools like these make a great difference. Works perfect. Thanks.

I tried and all the Facebook "likes" disappeared. What can I do to keep them on the new links? Thank you.

Try deleting your browser's cache.

Works great to me!!
Also i'm very curious if cache plugins such W3TC and WP Super Cache effet the SEO in not positive way..??

Yes, caching will improve performance and therefore have a positive effect on ranking.

Hello David!

I know performance and fast websites may get positive ringings,but also search engines not like static content its true ?

i am using permalink year/month/post name .. http://royalyouth.com/2011/12/how-to-deactivate-facebook-timeline/
which is better.. plz suggest..

Thanks for this. Did it and all seems to work great. I did lose my numbers but perhaps Twitter, FB and LinkedIn will eventually catch up.

In any event having read the comments I knew that was likely to happen, but your logic made sense to me in terms of my own blog content, so no more dates it is!

Hi! I have an issue changing from the http://ellenminerva.com/?p=123 structure to the new http://ellenminerva.com/sample-post/. I have tried to disable all plugins, before attempting to change the structure, but I still get the 404-error when attempting to view the post on this site, after updating the structure.

Your "generate redirects" tells me wordpress should do this automatically.

Any thoughts on this?

Thank you Joost, as always amazing tips and insights. The code worked instantly and all posts are as they should be. Huge fan!

My blog is in a subdirectory.

Before changing the permalink structure, a sample article had the URL of "http://www.sleeter.com/blog/2011/03/quickbooks-2011-r6/" for example.

After changing the permalink structure the article URL changed to "http://www.sleeter.com/blog/quickbooks-2011-r6/"

THe redirect that was generated was "RedirectMatch 301 ^/blog/([0-9]{4})/([0-9]{2})/(.*)$ http://www.sleeter.com/blog/$3" - and I added it to the .htaccess file

However, if I then tried the old URL I got a page not found error. I've successfully made this change in OTHER blogs that do NOT reside in a folder...

I want to my site display Post Nam | Site Title
What can i do?
Thanks for all!

Since upgrading both the Yoast plug-in and WordPress to 3.3, the url in my posts have had numbers like this:- #.Tv9rpjWRHNU added after the trailing slash.

The custom structure box is set to: /%postname%/.

How do I get rid of the extra bit '#.Tv9sUDWRHNW' and why is it there?

I have asked on the wordpress board, but got no reply.

WIth thanks if you can help.

Wish I had read this a few weeks ago . As a novice I hadn't paid much attention to permalink structure. I let WP take care of it for me, which resulted in a year/month/day structure. But because the "blog" is composed of letters from the 1930s I got the brilliant idea of back dating the posts, once they were published, to the original dates on which they were written. after trying a test post, I back dated six months of letters.. It worked fine .. The archive tabs now show the correct dates. But of course all of my google links and external links were broken... I eventually started using Rolfe's 404Redirect plugin but it seems to be doing more than it needs to and identifying many more 404s than it needs to. I was going to write you a couple of weeks ago. I'm going to read your post again in the morning and see if I can tell you simply what concerns me. Just learned the plugin has not been tested yet with WP 3.3. Any reason I should disable Rolf's plugin in the meantime?

Thank you so much! I had been wanting to switch to post name only for SEO reasons, but was worried about the past links not working. I have very little knowledge of the back end of things, but was able to use your instructions and edit my .htaccess file. It is all working correctly! Woo hoo!

Worked like a charm. Thank you. I hated the way the numbers appeared on my post showing the date and the month. We write timeless articles for Teachers and this was a great inconvenience. Solved by your post. :)

Hello

After change my permalink in Google Web Master Tools get the old permalink as duplicate. How can i clean those duplicates ?
I use Yoast SEO Plugin..
Any Help ?

Hey,

I changed my permalink structure, added the redirect into the .htaccess file.

If I clicked any of the links from within my page they redirected fine, but checked a few links from with google searches and when I clicked through to my site via these I got 404's ??.

I have reverted everything back for the moment... any suggestions/ideas on what I did wrong?

Thanks for this post Joost. Can you clarify whether WP 3.3 resolved performance issues with the /%category%/%postname% structure or just %postname%? There seem to be different opinions on this across different sites.

Thanks!

Hi Joost, can you please help with this:

I want to use /%postname%/ and rebuild my old URLs with the custom slug editor for each post. I thought this would be no problem, but when I type in a custom slug, containig a slash it gets stripped out and replaced with a dash.

Can I force WP to keep the slash in the custom slug?

This discussion has been very helpful and I do need to redirect my permalinks from the the default setting (I know, should have done it before I started). But one question in editing the .htaccess file - you say add the generated code at the top of the file. Does that mean before everything or between the "Begin" and End" lines? This is what I have at the top the file currently:

# BEGIN WordPress

# END WordPress
RewriteCond %{HTTP_HOST} ^marginlines.com$ [OR]
. . .

And then (obviously) it continues with some other stuff. I'm just not positive where to put the generated lines - and my apologies in advance for being a bit of a newbie when it comes to editing these files!

Thanks!

-mark craig

Indeed a great article, really helpful comments and afterall the redirect tool is very useful. But still I could not redirect from
/%category%/%postname%-%post_id%.html to /%category%/%postname%.html
Thank you.

Comments closed, if you feel you have something to say:
drop me a line.