Posts Tagged ‘permalinks’

Configure WordPress Permalinks - SEO advices - Part 2

December 12th, 2009

In the first part we have talk about how bad and dangerous could be configuring permalinks in WordPress blog. In this article we will show you solution for best configuring permalinks!

So What is the Solution?
The solution is to use a permalink structure that does not start with a text based variable.  By doing this you will drastically reduce your risk of the problems listed above.  Here is a list of variables you can use that are not text based:

  • %year% – The year of the post, four digits, for example 2004
  • %monthnum% – Month of the year, for example 05
  • %day% – Day of the month, for example 28
  • %hour% – Hour of the day, for example 15
  • %minute% – Minute of the hour, for example 43
  • %second% – Second of the minute, for example 33
  • %post_id% – The unique ID # of the post, for example 423

Now that doesn’t mean you can’t have text based variables in your permalink structures, you just need to make sure the first variable is not text based.  One good solution we recommend “/%year%/%monthnum%/%postname%”.

Why Would The SEO Experts Recommend The Wrong Structure?
The reason SEO experts recommend the “/%postname%” or “/%category%/%postname%” structure is simple.  It makes the URLs easy to remember and it introduces keywords into the URL string that should match the content of your post.  Typically in SEO the shorter the URL the better as its easier for the users to remember.  The reason some SEOs recommend adding %category% to it is because categories normally include common keywords in the name that match the contents of the posts in that category.  Are these extra 2-3 keywords from %category% worth it?  Not in my opinion.

A better question would be why aren’t SEO experts recommending the permalink structure of “/%year%/%monthnum%/%postname%”?  A simple answer to that one would be because they think the URL might be too long or they are unaware of the issues I am writing about today.  After all some of these problems were not introduced until Wordpress 2.7 was released.  Hopefully some of the SEO experts will read this article and change their recommendations to their customers.

Why Blame the SEO Experts For This?
SEO experts are the ones who always are trying to optimize their pages to get the best search rankings possible.  They are likely the reason that these options even exist for the permalink structures.  Always wanting to get a extra 2-3 keywords in the URL out of the %category% tag or wanting to shorten the URL to just “/%postname%”.  It’s just insanity.

Of course there is always the fact that they are the only ones I see recommending this to people because of the optimization boost that it can give you.  If it wasn’t for SEO, there would be no reason to use one of those permalink structures except to make things look pretty.

How Do I Know This is Real and Not Just Your Crazy Opinion?
That is a very good question.  Unlike the SEO experts opinions, I happen to have the official Wordpress documentation on my side.  The Wordpress Codex page for Permalinks specifically states the following:

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 to start your permalink structure with a numeric field, such as the year or post ID.

Really who is going to argue with the official documentation?  Just in case you still think I might be making it up, here is a link to a discussion on the Wordpress Testers mailing list thread that discusses these very issues.

Now as of the time of this writing there is a patch for part of the problem listed above.  A user has provided the Wordpress developers a patch via the Wordpress Trac site to make the generation of internal redirects faster when authors save a post or a page.  While I believe this is great, it still doesn’t solve the issue of those redirects needing to be there in the first place.  Even if you generate the redirects faster, you still have the problem of having to process them with every request from a user.  Seems like a band aid over a much bigger problem.

Configure WordPress Permalinks - SEO advices - Part 1

December 7th, 2009

In this article HOST-ED.NET team has collected the best practices and advices from internet for configuring in the right way Permalinks. Because if you follow advices of some “SEO experts” your permalinks should be with simple and “good-looking” pattern. But this could be very bad and dangerous practice!

Let us start by giving a nice big thanks to experts in the SEO community.  It’s likely because of them that there are literally thousands, possibly millions, of Wordpress installations that setup with less than optimal settings.  Many unsuspecting and uneducated users look to this group of experts for ideas and techniques to improve their search engine rankings and to gather more website traffic.  Little do these users know that even some of the most popular people in this group of experts are handing out bad advice regarding how to setup Wordpress systems.

Bad Wordpress Permalinks Advice
Most of the SEO experts on the net recommend that users setup their Wordpress permalinks in a very specific way.  Every article on the net I have seen written by an SEO expert regarding Wordpress permalinks suggests that users either use “/%postname%” or “/%category%/%postname%” for their permalink structure.  This is a bad idea for many reasons, which I will cover below, yet the SEO experts continue to promote it.

Why Are Those Permalinks Structures Bad?
Well to sum it up very simply it comes down to two things.  Speed and Reliability.  Thinking from the blog readers points of view these have to be the two of the three most important items that your blog can give them.  The third of course being content, but that’s not what we are here to talk about today.

Let’s start off with reliability and how these permalink structures affect that.  Both of these permalink structures have the first variable in the structure as a text based keyword.  The variables I am talking about of course are %category% and %postname%.  Unfortunately by using a text based variable you can cause Wordpress to get confused when the system goes to process the request from your users.

Let us start by giving a nice big thanks to experts in the SEO community.  It’s likely because of them that there are literally thousands, possibly millions, of Wordpress installations that setup with less than optimal settings.  Many unsuspecting and uneducated users look to this group of experts for ideas and techniques to improve their search engine rankings and to gather more website traffic.  Little do these users know that even some of the most popular people in this group of experts are handing out bad advice regarding how to setup Wordpress systems.

Bad Wordpress Permalinks Advice
Most of the SEO experts on the net recommend that users setup their Wordpress permalinks in a very specific way.  Every article on the net I have seen written by an SEO expert regarding Wordpress permalinks suggests that users either use “/%postname%” or “/%category%/%postname%” for their permalink structure.  This is a bad idea for many reasons.

In fact I was at SearchFest, a Portland SEO & search marketing conference, in March and I watched an SEO expert use this as his suggested permalinks structure to an entire room of people during a Wordpress SEO session. Now I just feel bad for anyone who actually wrote down or took that advice.  There are much better ways of setting up your permalink structures.

Why Are Those Permalinks Structures Bad?
Well to sum it up very simply it comes down to two things.  Speed and Reliability.  Thinking from the blog readers points of view these have to be the two of the three most important items that your blog can give them.  The third of course being content, but that’s not what we are here to talk about today.

1.SPEED

Let’s start off with reliability and how these permalink structures affect that.  Both of these permalink structures have the first variable in the structure as a text based keyword.  The variables I am talking about of course are %category% and %postname%.  Unfortunately by using a text based variable you can cause Wordpress to get confused when the system goes to process the request from your users.  The reason for this is that there are just too many possible items it can match.

When we look at a example URL of “/blah-blah-blah/”, Wordpress can run into problems when trying to match items to the request.  Does it match a category, a page name or a post name?  All of these text based variables use the same pattern matching so the system would have to run multiple database queries to figure out what the user is looking for. That’s not to mention the fact that the system also has to parse that request for attachments, tags, author pages and feeds which all use text based keywords as well.

Even then the system could get confused if you have a page/sub page combination that matches the slug of a category/post combination.  Which one should the system load?  These combinations of random keywords could easily cause Wordpress to load the wrong page or post for a user which in turn makes your site less reliable in the user’s eyes.

So now compound all of the above with the speed issues.  The most obvious of speed issues is that Wordpress has to run all of those database queries that I mentioned above.  Those are not lightweight and fast queries.  They take time and delay the loading of the page that the user is requesting.  How many times have you left a site because it loaded too slowly?

Another speed issue is for the Wordpress author themselves. When using a permalinks structure with a text keyword as the first variable you end up causing Wordpress to generate internal redirects to try and fix the issues mentioned above.  These redirects are stored in the wp_options table in the database and are generated when authors add and edit posts or pages in the system.

The system is semi smart and generates internal redirects for all the pages that are loaded into the system.  A simple page with a couple of attachments, whether they are displayed or not, can easily generate 11 internal redirects in the database.  This is because the system needs the redirects for the page, it’s attachments, the trackback URLs and feeds that go with it.  To make matters worse the system has to have a line for the redirect as it would show up in the request, the permalink for the item, and a line for how Wordpress is to understand that request.  So now we can double the number of lines in the database for that one post to 22 lines.

So by using the permalinks structure with the first variable being a text based keyword the system now generates these redirects upon saving a post/page and causes delays for the author.  In fact there have been reports where users with 200 or so pages, with random attachments, in their Wordpress installations actually causing server time outs during the generation of these redirects.  This causes them not to be able to post to their Wordpress installations at all.

Continuing with the speed problems, lets not give up on those internal redirects.  Those internal redirects also affect the users of the website and their page loading speeds.  With every page request the system has to load all of those extra redirects and process them.  That’s 22 extra lines of code per request that has to be processed before the page will load for the end user.  Imagine if you had a simple site with 10 pages, that’s an extra 220 lines of code.  That is of course is on top of the other 125 lines of code for internal redirects that Wordpress needs by default with no pages.

I took a look at one of my customers blogs who has 24 pages and compared that to his internal redirect list.  His redirect list had a total of 773 lines of code that needed to be processed for every request to his blog.  As you can see that 22 lines of code is a lower end figure when compared to his total number of pages.  On our blog we have 22 pages and do not use one of the permalink structures above.

Be advised that none of this touches on what kind of damage your doing to your server.  Since Wordpress is written in PHP and MySQL, all of the requests and code are processed on the server side rather then the user’s end of the connection.  By adding excess lines of code for redirects and increasing your number of database queries, you are also increasing the amount of work your web hosting server is having to do.  That also isn’t a good thing.

To be continued….