WordPress Short URL using Post ID (plus its Effect on SEO)

I recently changed this site’s permalink format from wplover.com/postname to wplover.com/post-id/postname. At first this is simply done because I’m curious, but it turns out there are a couple of advantages to this:

  • Using post ID is good: “…it is best to start your permalink structure with a numeric field, such as the year or post ID.” (source)
    I’ve read somewhere that /post-id/postname/ is faster than /postname/ to process because using the latter there is no difference between a Post and a Page permalink, so WordPress have to take the time to check for that as well. If you use /post-id/postname/, the link structure for a Page will be /pagetitle/ (without ID). Try as I might, I can’t find the source from this information, so please correct me if I’m wrong.
  • …and the whole point of this post: you can use yourdomain/post-id/ as a short url, useful to post to Twitter and the like. Here’s an example: http://wplover.com/632/

How will using that post-id based short URL affect SEO, though? To find out, I tried to dig into WordPress’ code that redirects the short URL into the actual URL. This is from wp-includes\canonical.php line 202 (as of WordPress 2.8.x):

if ( $do_redirect ) {
// protect against chained redirects
if ( !redirect_canonical($redirect_url, false) ) {
wp_redirect($redirect_url, 301);

So they’re using 301 redirects according to that last line. This is the right way, SEO-wise:

301s are good for SEO value, while 302s aren’t because 301s instruct clients to forget the value of the original URL, while the 302 keeps the value of the original and can thus potentially reduce the value by creating two, logically-distinct URLs that each produce the same content (search engines view them as distinct duplicates rather than a single resource with two names). (source)

301 redirects tells search engines that that short URL and the full URL is the same and not a duplicate, which is good (because duplication reduces the value of both URL).

So, in essence, all’s good, godspeed, have fun with the short URL.

2 Responses to “WordPress Short URL using Post ID (plus its Effect on SEO)”

  1. SEO Plugin

    These easy to install the plugin from here SEO and you have such a problem does not http://www.undergroundtraininglab.com/

  2. Rose

    Thats so cool. I love this post u write…Will email some of my friends who interested in this…Thanks.

Leave a Reply

Latest Links More →

Custom Shortlinks for WordPress

Have your own short domain name for the purpose of shortlinking? Here’s an easy way to combine that with your WordPress install.

The Quick Start Guide to Using Google Webmaster Tools With WordPress

GWT is a great, frequently updated features like showing you search queries volume, malware and crawl error diagnostics and links to your site. If you don’t use it yet, you probably need to. This will help you get started.

WordPress & jQuery Contact Form without a Plugin

I would recommend this either if you want more flexibility or to learn how to code a contact form.

Understanding and cleaning the pharma (spam) hack on WordPress

How to fix that hack:

This attack is very interesting because it is not visible to the normal user and the spam (generally about Viagra, Nexium, Cialis, etc) only shows up if the user agent is from Google’s crawler (googlebot). Also, the infection is a bit tricky to remove and if not done properly will keep reappearing.

Web Safe Fonts Cheat Sheet

An updated (written in April 2010), well researched, CC-licensed Web safe fonts cheat sheet, available both in low-res PNG and high-rest PDF. Even the article is useful as well.

The Nicest 2010 Child Theme You’ll See Today

The Timaru Mental Health Support Trust website, made for charity by Team USA (comprised by web superstars like Jason Santa Maria, Dan Mall, Liz Danzico and Automattic’s John Ford) during the FullCodePress competition, is actually a clever child theme of 2010.

More recap by JSM, Daniel Mall, and Liz Danzico.

WordPress 3.0 Theme Tip: The Comment Form

The simpler way to code comment form (once you understand how hooks and filters work).

Showing and hiding content with pure CSS3

I like it, I think it’s short and easy to understand.