How to Blog: Your Comprehensive Source for WordPress Themes, Plugins, Tips, Tricks, Reviews and News


Subscribe to our newsletter for the latest WordPress tips!

  • Home /
  • blogging
  • / How to configure WordPress to create search engine friendly URLs for permalinks

How to configure WordPress to create search engine friendly URLs for permalinks

facebooktwittergoogle_plusredditpinterestlinkedinmail

WordPress’s default behavior for permalinks is to create a URL that looks something like this:

http://www.yoursite.com/index.php?p=2

where p is the post id.

If you care at all about the search engines indexing your blog, and you should if you want anyone to read it :), you’ll want to use a little SEO (search engine optimization) trick by having nice, neat URLs that describe your post.

In my case, I wanted my individual post archives to be in the root of my domain, as search engines like Google devalue a page the deeper it is into the site. I also wanted the link title be the post’s name, so that my permalinks will look like this: http://www.yoursite.com/this-is-my-posts-title.htm

To do it:

You will need to have an .htaccess file and make it editable by WP. Sounds hard, but WordPress makes it easy. First of all, if you don’t know what it is, an .htaccess file is simply a text file that can contain instructions for the webserver. If you have an .htaccess file already, great. If you don’t have an .htaccess file, you’ll need to create a text file using any text editor (notepad will do) that simply has a blank page and upload it to your server. You will then need to change the properties of the .htaccess file on the server, most easily done with the same FTP program you probably used to upload wordpress to your server as well as your themes, the .htaccess files, etc. What you’re wanting to do is make the file writable. This can be accomplished by doing a chmod on the .htaccess file (many FTP programs offer this when you right click on the file -they give you an option of chmod or sometimes it is referred to as properties. So chmod the .htaccess file to 666 to make the file writable so that WordPress can edit it by itself to update the permalink structure. (If you don’t want to make the .htaccess writable by the server, then when you’re done setting up the Permalink structure WordPress will tell you what code to insert into your .htaccess file yourself using a text editor)

– log into WordPress, and then click on ‘Options’. Next click the sub-category under options entitled ‘Permalink’

– the page you’re on will now describe all the fields you can use to create your permalink. I only cared about the post name so in the edit box just underneath where it says, ‘Use the template tags above to create a virtual site structure:’ I typed the following:

/%postname%.htm

NOTE: for faster performance, it is better to include a unique variable such as the post ID number within the permalink structure If you choose to go this route, you could setup your permalinks as follows:

/%postname%-%post_id%.htm

or

/%post_id%/%postname%/

or

/%post_id%/%postname%.htm

– at this point you should click the button to Update Permalink Structure.

So now, my first WordPress post on my Tool Reviews Site can be found at http://www.toolreviews.biz/porter-cable-cffn250n-finish-brad-nailer-combo-kit.htm (btw – that post is more of a placeholder while evaluating WordPress than anything else..)

Personal Opinion Warning: Some sites have recommended including the category as part of the permalink, but this will slow down wordpress performance because many of your posts are likely to have more than one category so it can get confusing as to figure out which category WP will choose for your permalink.

The best time to set up ‘Pretty Permalinks’ is the moment you install your blog because if you already have a bunch of existing posts, changing the permalink structure will make it so that your old links to those posts will result in page not found errors – to fix this you would need to edit the .htaccess file to set up permanent redirects for each post and page in the form of:

Redirect 301 http://www.yoursite.com/index.php?p=2 http://www.yoursite.com/the-new-post-title.htm

This way people who have linked to your old URLs will get automatically redirected to the current page URL.

This all sounds WAY more complicated than it actually is when you follow the instructions step by step so don’t be overwhelmed – you can do it!