Am I About to Break Every Link on My Site with One Push of a Button?
June 4, 2010 11:05 AM   Subscribe

If I switch how Wordpress handles permalinks, will all my links break? Or is Wordpress smart enough to redirect things automatically?

According to SEO principles...

This:
http://www.sitename.com/?p=123

...is not as good as this:
http://www.sitename.com/sample-post-name-here/

Wordpress offers various means to switch this automatically. Rock on.

But what happens next?

If I press this button, will every hand-coded link on the site break? Or is Wordpress smart enough to go, "Oh, you're asking for 'p=123.' Yeah, dude, we changed that to 'sample-post-name-here,' so here you go. Peace out."

Or is Wordpress just going to shrug and go, "Sorry, man. I forgot what the fuck 'p=123' was supposed to be. Got any Doritos or something?"
posted by Cool Papa Bell to Computers & Internet (10 answers total)
 
Any links that are being dynamically created by Wordpress will change to the new permalink automatically.

Any link you specifically hard coded to point to /?p-123 will now point to a non-existent page. Better have some Doritos handy.

This is a quick thing to test if you want to be certain. Go into the settings, change the permalink structure, see what breaks, change it back and then things will stop being broken.
posted by cirrostratus at 11:33 AM on June 4, 2010


There are plugins that'll help with this. Or you can fix it manually if you want to be more bare-metal about it.
posted by clavicle at 11:35 AM on June 4, 2010


I changed it a few weeks back, installed one of the redirection plugins which I'm not really sure is doing anything as Wordpress seems to handle it all. To be honest I'm not sure what cirrostratus means about the hard coded link, it seems to handle situations like that.
posted by jontyjago at 11:42 AM on June 4, 2010


I think actually you can still use the old structure ?p=123 when you turn on the new permalinks using a mod_rewrite without things breaking. But this is one way you can't go from mod_rewrite to query string.

This
http://www.sitename.com/?p=123
to this:
http://www.sitename.com/sample-post-name-here/

I think won't break existing links that are like
http://www.sitename.com/?p=123
posted by bitdamaged at 11:45 AM on June 4, 2010


Generally, permalinks are is handled with mod_rewrite. Which means it's just rewriting pretty links into ugly ones for PHP forms. I haven't tried it, but it would make sense that this doesn't actually disable the old links.
posted by pwnguin at 11:49 AM on June 4, 2010


yes, the old links will still work.
posted by jrishel at 12:22 PM on June 4, 2010


The old links will still work. I haven't plumbed the full depths of Wordpress' rewriting smarts, but I've never used .../?p=123 form links in my WP blogs, and those links work anyhow. I've also found that if I change the slug for a blog entry, the old slug will continue to work. Nice.

BTW, Wordpress is more a fan of Cheetos than Doritos. I know, crazy, right?
posted by adamrice at 12:35 PM on June 4, 2010


Yeah, this should work fine. I had something similar four years ago (except on IIS, which was zero fun), and everything handled itself ok.

My understanding is that mod_rewrite is working like a shortcut - the fact that your post is number 123 is still stored in your database, so it's not like you're losing anything, it's just referring to the same thing in a different way. Still gets to the same place.

Cool Papa Bell I'mma let you finish, but doing this with ISAPI rewrite was one of the most annoying things of all time...of all time...so I'm going to chuck this in for posterity, which helped me out with this issue on IIS. Hopefully that's cool.
posted by djgh at 2:04 PM on June 4, 2010


It's smart enough. I changed my permalinks a few weeks ago and it was completely painless. The latest version of WP will do everything automatically. I didn't have to use any plugins or make any changes to my .htaccess file.

I tried it out on my "test" site first. I set-up a bunch of test posts and bookmarks and all the links went to the right places after I pushed the button.
posted by 14580 at 7:55 PM on June 4, 2010


Yes, the links will continue to work - you can link to a Wordpress post using a variety of URLs, and your permalinks setting is just a way of determining which of those variations is considered "canonical". You can read more about canonical URLs in this blog post by Mark Jaquith, which I could also link to using this link, or this one.
posted by oulipian at 4:39 PM on June 6, 2010


« Older Help us get rid of this infestation.   |   Cheap home theatre solutions Newer »
This thread is closed to new comments.