WordPress versus the Long URL Post Slugs, or How I finally got my really, really, long WordPress URLs to work just fine, even when they get broken in email.

FlexURL is a plugin to help readers find your blog even when then the URL has been word-wrapped in someone’s email.

Yikes, what a title, eh? For those of you who know, Google loves keywords in your URL. For those of you who don’t, I won’t be explaining it here.

But this is the reason my Permalinks format is /%post_name%/ and nothing else. I write long descriptive post titles to get Google’s attention. And normally this is no problem because nobody types URLs in manually anymore. Trackbacks work, links work, etc.

But what about email? You’ve all seen this one, right?

From: frood28973@twc.rr.com
Subject: Windows problems on April 12?

It was in the paper last night. Can you guys believe it? Here’s the link:
http://www.askdavetaylor.com/why_are_windows_people_calling_april_12_
updatecrash_day.html


Yahoo! Groups Links

  • To visit your group on the web, go to:

You see the problem right away. The link is broken. You might get lucky and find the article by clicking on it, because not all of the URL may be relevant. If it doesn’t work, you know how to fix it. But there will be at least a half dozen follow-up emails on the list complaining about the broken URL. Then there will be another half dozen explaining how to type the whole URL in. Then at least one person will send the “corrected” link, only to discover that it got wrapped too.

But what if the link is to your blog? Or worse, to my blog!

I want people to be able to find my blog entries when they’re cool enough to get emailed, even if the URL is too Googular to fit into anyone’s email app, newsgroup autofilter, etc.

In short, I want all these URL’s to work the same:
http://www.philhord.com/phord/his-dark-materials-the-golden-compass-the-subtle-knife-the-amber-spyglass/
http://www.philhord.com/phord/his-dark-materials-the-golden-compass-the
http://www.philhord.com/phord/his-dark-mat

In fact, if the first part of the URL matches one and only one post, I want that post to be the “found” post for that URL. If the first part of the URL matches more than one post, I want all those posts to be found and listed.

Enter the FlexURL plugin. My friend Leo who has a Technical Questions site came up with this idea and implemented it on his blog. After he described it to me (and after I got over my awe at the simplicity of the idea), I set about implementing it on WordPress.

It wasn’t easy, actually. The plugin is very dependent on the internals of WordPress. So I set it aside for a few weeks and promptly forgot about it. Then another friend of mine and Leo’s, Dave Taylor of AskDaveTaylor.com fame (a great Tech Support site), announced that he had implemented his own version for his blog. I couldn’t let this challenge go unanswered, so I got back to my plugging in. And FlexURL is the result.

FlexURL only works on WordPress 1.5 and later (but see below for a 1.2 solution). I’ve tested it on 1.5, 1.5.1.2 and 2.0 [updated entry: 03/15/2006]. It works fine on all of them. But please use caution. After you activate FlexURL, please check the rest of your site and make sure it all works. The hooks I’m snooping are powerful and could cause problems. Let me know if you see any. (By the way, any problems you do see should go away when you Deactivate or delete the plugin.)

I still consider this beta software. This has worked well for me for a long time, now. [update: 03/15/2006]
Here’s the plugin [download] and in source form .

Install it in the usual way:

  1. Copy the file to your wordpress/wp-content/plugins directory.
  2. Open your WordPress Admin control panel and click the Plugins button.
  3. Find FlexURL and click on its Activate button.

[Update 03/15/2006:  changed wording to reflect WP 2.0 compatibility.  Also, updated plugin code to work around problem with some people's .htaccess setup.]

67 Responses to “WordPress versus the Long URL Post Slugs, or How I finally got my really, really, long WordPress URLs to work just fine, even when they get broken in email.”

  1. biloper says:

    Действительно то что надо! А то сколько не лазишь по нету сплошное бла бла бла. Но не тут, и это радует!

  2. Natawaiday says:

    От безбожья до Бога – мгновенье одно.
    От нуля до итога – мгновенье одно.
    Береги драгоценное это мгновенье:
    Жизнь – ни мало, ни много – мгновенье одно!

  3. shephene says:

    Можно и подискутировать по этому поводу …

  4. cissatsMaW says:

    Благодарю!!!У Вас часто появляются очень интересные посты! Очень поднимаете мое настроение.

  5. appeamidyek says:

    Я уже сегодня писал вам по поводу продаи (цены) вашего домена. Но зашёлш из дома провертиь ваш ответ, а своего комментария так и не обнаружил. Видимо, я его как-то не так отправил, или у вас спам-фильтры зарубили мой комментарий, я на всякий случай поменял указанные е-мейл, ник и сайт, вдруг они не нравятся вашему фильтгу.

  6. VietsMig says:

    Классно всё: и картинка ,и информация

  7. Joftbife says:

    Я в принципе, мало, что смыслю в этм посте, но постараюсь все таки понять.

  8. appeamidyek says:

    Достатно интересно конечно. Хотя я немогу подписаться под каждым словом, но в общем соглашусь.

  9. benfleliA says:

    Это переходит все границы.

  10. Павел says:

    Да все понятно, Спасибочки за пост.

  11. porndscg says:

    На нашем сайте не нужно платить за просмотр порно онлайн большая грудь – у нас все порно трансвеститов смотреть онлайн, смотрите сучки порно онлайн и наслаждайтесь зрелищем

  12. nichdfld says:

    Сайт, где не нужно платить за просмотр порно видео хентай онлайн – у нас все порно онлайн золотой дождь, смотрите порно онлайн очень юные

  13. Anonymous says:

    Привет, хотелось бы предоставить на ваш обзор блог посвященный автомобильной тематике! Тут вы сможете отыскать решения на все взбудораживающие ваши вопросы!!!

  14. cwsupport says:

    Только здесь оптимальная продажа игрового золота и набор хонора в World of warcraft на доступных условиях. Мы выполняем поднятие рейтинга на арене и походы в рейды в игре wow с гарантией. Хорошая возможность прокачать персонажей wow.

  15. Добавил в рсс, посмотрим, чем еще порадуешь %)

  16. Anonymous says:

    Хай, хотелось бы показать на ваш обзор дневник посвященный автомобильной тематике! Здесь вы сможете найти решения на все волнующие ваши вопросы!!!

Leave a Reply