Using Pretty Permalinks in WordPress
What is a Permalink?
A post–or part of one–in WordPress can show up in many different places. A summary can be on the front page and on category pages.
A user can find it through a search. The title can be shown as "Next article" or "Previous article" or in a list of popular articles in a widget on your sidebar.
However, there is one "official" address of the post. This URL is called the permalink.
Why Change the Permalink Structure?
If you take the default options, WordPress will use the post ID as part of the name. For example, the permalink of your hundredth post will have a URL like this:
http://somedomain.com/?p=100
This is very functional but not very meaningful to your users. Furthermore, your Pages get the same kind of numbering system. This was my biggest reason for disliking the numbering system. For example, for my MoreAfter WordPress Plugin page, I would rather have:
http://wakeshine.com/moreafter
than, say:
http://wakeshine.com/?p=36
Where does WordPress get the text name for the URL? On the right of your Post Editor is a box called "Post Slug." You can create your own, or WordPress will give you a default name based on the title of your article or page.
I’ve seen many different ways of using pretty permalinks for posts. It comes down to personal preference, and it also depends upon what type of blogging you’re doing. WordPress has some standard types ready to use:
http://somedomain.com/?p=123
http://somedomain.com/2007/08/24/sample-post
http://somedomain.com/archives/123
In addition, there is a Custom option where you can specify your own, using various tags that WordPress supplies. Custom URLs have to end with either the post name (the slug name) or the post id.
I don’t like the "?p=123" type of URL. I want my URLs to have personality. I don’t care for the dated ones, because the date has nothing to do with my posts. I may go back and change them. And I don’t like the word "archives" in my URL. Makes the articles sound old the day they are written.
One custom option is to use the category name in the URL. I don’t like that because I tend to use multiple categories, and the URL just uses one at random (the lowest-numbered category).
For this site, I chose a simple custom structure: /articles/%postname%/
One interesting thing I noticed (which I’m very happy about): The pages don’t use the /articles/ portion of the custom permalink…they just use the post slug. That’s perfect.
Making it Happen
Depending upon your hosting company, this could be very easy, slightly tricky, or impossible. Detailed instructions for using pretty permalinks are here at the WordPress site.
The good news is that you can test it out, and if it doesn’t work, you can switch back. The "very easy" scenario is to go to the Options / Permalinks section of your WordPress administration…

and select the permalinks you want:

Check your site. If the links are working, you’re done. If not….
The next step is to check the access level of a file on your server named .htaccess. WordPress needs to modify this file in order to make permalinks work. It looks like many people set the access level of this file to 777, change their permalink structure through the WordPress administration pages, and then change it back to 644. See the WordPress article for more details on how to modify this file.
The impossible case…your hosting company has to support a module called mod_rewrite on their server. This will allow browsers to show up at your site with the nice URLs and get redirected to the PHP page which will sort it all out. If your hosting company does not support this module, then this style of pretty permalink is out.
However, you can still do better than ?p=123 if you don’t mind embedding "index.php" at the begining of your custom URL. See this article for details.
Changing the Permalink Structure of an Existing Blog
If you have an existing blog, should you switch from numbered links to pretty permalinks? According to Jill at highrankings.com, putting keywords in your URLs does not help nor hurt your search engine rankings. However, she does warn that changing existing URLs can start you over on the indexing procedure. It’s good to decide early on what kind of permalinks you want and stick with it.
If you liked that post, then try these...
Using WordPress Widgets by Doug on August 21st, 2007
I've just discovered WordPress Widgets.



Leave a comment