Permalink means how a URL of a WordPress post appears. To have nice looking Permalinks, your web server should be Apache with mod_rewrite module. Almost all Linux web hosting packages are in this configuration. But be sure before choosing a web host if you really want Permalink functionality.

Setting your desired Permalink structure is a very first thing you should do after installing your WordPress blog because search engines index your blog based on post URLs and if you change from one to another then you will loose your rankings. And also other web sites link to your blog using them and changing can also stop those traffic flows. To configure your Permalinks click Options tab in your WordPress Dashboard and then Permalinks.

WordPress Permalink Types

Which Permalink Structure Is the Best?

Obviously Default and Numeric won’t be your options. You may also not want to bother with Optional suggestion. You will have to choose between Date and name based and Custom. Date and name based will be great if your blog is more news oriented and less categorized. But if your blog consists of many all-time articles and can be well categorized then you better go with a Custom Permalink structure.

Custom Permalink Types

You can use number of variables to define your Permalinks. You can get all of them and some other information at WordPress Codex. Most of the time, you will only need %category% and %postname%. You need to use forward slashes ( / ) to separate these variables. Followings are the highly used custom Permalink structures.

/%category%/%postname%/

Probably this will be your choice. It tells the user to which category the post belongs. A sample post will be like below. Here technical is the category and understanding-web-technologies is the post name. Post name is created using your post title (If you didn’t change Post Slug manually). All the letters are converted into lowercase and words are connected with hyphens (-). If the title contains special characters like question marks (?) then those will be removed.

http://www.homebizpal.com/technical/understanding-web-technologies/

If a post belongs to a child category then both parent and child categories will be displayed. Parent name comes first. For an example this post belongs to WordPress category which is a child category of Blogging and the URL is like below.

http://www.homebizpal.com/blogging/wordpress/understanding-wordpress-permalinks/

Very Important!

If a post belongs to two categories then the one with a top category ID will be selected as the category name (Note that category IDs are assigned according to the order you created them, not according to alphabetic order). For an example Understanding Alexa Rank belongs to both SEO (Category ID is 10) and Technical (Category ID is 5) and Technical has been used as the category name since it had a top category ID. The URL is as below,

http://www.homebizpal.com/technical/understanding-alexa-rank/

What would happen if I assign another category to the post? If the category ID is below the current one then there won’t be any problem but if it is above then that category name will be applied and whole URL will be a new one which you should take care not to happen. So, be careful about it before assigning a new category. For an example if I assigned General (Category ID is 1) to above post then the URL will be changed as below.

http://www.homebizpal.com/general/understanding-alexa-rank/

/%postname%/

This will only display the post name in the URL. This can be used if your posts can not be categorized well. Assigning new categories or changing them has no effect on this structure.

/%category%/%postname%.html

Some are also using this structure which will make URLs like below. The intention is to show posts as static HTML pages.

http://www.example.com/category/postname.html

How to Recover After Changing Permalink Structure

As stated, you should take care not to change Permalink structure after your blog has been established. However if you blog is new and you really need to change the structure, you can redirect old URLs to corresponding new URLs using 301 redirects which is also a search engine friendly way. If you changed from one structure to another, WordPress may ask to paste a peace of code to your .htaccess file which you also need to set your 301 redirects.

.htaccess is a simple file that Apache web server uses to get webmaster inputs. You can do things like creating password-protected directories and redirecting with this file. It should be placed in your root directory of your web site. If one is not already available, simply open a text editor, enter instructions you want and save the file as .htaccess and upload it to your server. You can create a 301 redirect as below.

redirect 301 /2006/12/18/postname/ http://www.example.com/category/postname/

Here the old post URL,
http://www.example.com/2006/12/18/postname/

will be redirected to new URL,
http://www.example.com/category/postname/

Note that in the definition, first part is the old URL without domain name and the second part is complete new URL. Keep whole definition in one line (Don’t include line brakes using Enter button). Also note where to apply spaces (There is a space between old URL and new URL).

Recovery Plugins

Dean Lee has developed a Permalinks Migration Plugin for WordPress which lets you migrate from one structure to another without loosing your SE rankings or visitors. It creates 301 redirects for you. As reported, it hasn’t worked for some people. Try it yourself and see. You may also want to install Alex King’s 404 Notifier which reports broken links in your blog to see whether everything is going right.

Permalink Effect in Search Engine Optimization

Including relevant keywords in your URLs rather than numbers or special characters (? and %) is a really good way to fine tune your search engine optimization. Categorizing also gives good clues to search engines. You can achieve these using custom Permalinks. Note that major search engines like Google can also index URLs with ? and & characters. Therefore you will get an advantage only when you have got other factors right.

Digging through Permalinks

Actually major advantage of a good Permalink structure is usability. They are informative and users can view other posts in a category very easily. For an example by removing understanding-wordpress-permalinks in URL,
http://www.homebizpal.com/blogging/wordpress/understanding-wordpress-permalinks/

makes,
http://www.homebizpal.com/blogging/wordpress/

where you can see all the posts in WordPress category. Further removing wordpress part will list all WordPress related posts as well as the ones which only belong to Blogging category. Same happen in Date and name based structures. Removing the date will list all posts for that month and so on.