Cool Query of the Day

To remove trailing slashes from URIs: UPDATE `blogs` SET blog_uri = LEFT(blog_uri, (LENGTH(blog_uri) - 1) ) WHERE RIGHT( blog_uri, 1 ) = '/'; Rows affected: 328,561 in 92 seconds.

9 thoughts on “Cool Query of the Day

  1. I agree with John. This is a time-waster for the client-side on most servers. It’s not a show-stopper for linking (as omitting ‘www’ often is) but it can delay the experience during the extra round trip.

  2. Unless I’m missing something, since with WP you’re using mod_rewrite, it doesn’t matter whether there’s a trailing slash or not?

  3. Matt: I’m sorry, I “Left Comment” without checking the “Name” field because I trust in Firefox to fill remember my name and stuff. But somehow this didn’t work this time…..maybe it’s because it’s my first comment on this page? You never know.

Leave a Reply to MattCancel reply