Clean URL’s with Wordpress
This tutorial will show you how to setup Wordpress to use clean URL’s. Using clean URL’s is one of the first step in Search Engine Optimization (SEO). Besides that, they just look better.
The default Wordpress URL structure is: http://www.yoursite.com/?p=123. What does p=123 even mean? Well, I would guess that it is the post id, but what does your reader see? A URL like this will be much better: http://www.yoursite.com/category/title-of-the-post be much better. It will have some meaning to your readers, and more importantly, search engines. The title is one of the most important things a search engine will look at. The better your site places on the SERPs (search engine results page), the more traffic you will drive to your site. Of course this is only one step in SEO, but is a good start.
There is one thing to keep in mind before you change your permalink structure. You will lose inbound links from other sites and search engines. If you have a large amount of traffic from direct addresses or bookmarks, you will not have to worry about this. If you are just starting out (as we are here at www.teamtutorials.com), I would recommend going with clean URL’s from the start. It is really simple to make a custom permalink structure for Wordpress.
First, if your .htaccess file is writeable, Wordpress is supposed to update it automatically. If not it will give you the code to cut and paste into your .htaccess file. I have had problems letting Wordpress edit the .htaccess file in the past (it never seems to update it), so I will edit it manually.
Log on to your Wordpress account as the administrator and click on Options and then Permalinks. You should see a page similar to the one below.
![]()
As you can see, the default settings are select. We want to enable custom URL’s so click the option button next to “Custom, specify below”.

Now we need to define the URL’s. There are many variable that you can use, but I will choose to use the category and postname variables. If you would like to use something else (day, month, year, posted, subcategory, etc.) you may want to see the custom permalinks page on the Official Wordpress site. In the “Custom Structure” box, enter the following.

Now scroll to the bottom and click the “Update Permalink Structure” button.

Now, if you have a writeable .htaccess file, you can ftp to your site and check to see if .htaccess file was edited. If your .htaccess is not writeable, or Wordpress didn’t update it, you will need to enter the following code in the file and upload it to your site.

This will tell the server that when it see http://www.yoursite.com/categiory/post-title-here to rewrite it to http://www.yoursite.com/index.php?somevariable , but the user will see the clean URL.
To test it, make a new post or use an existing one. Click the link from your homepage to get to the permalink and look at the URL in the web browser. You should see the clean URL and the page should be displayed properly.
![]()
Here is our ugly default URL versus the clean URL for the same post.

This is an easy way to optimize your site for search engines and be easier on your readers eyes. If you have any questions, just leave a comment, I will answer as quickly as possible.
Popularity: unranked [?]


























on April 19th, 2007 at 3:46 am
Great tip, thanks
I’m going to make sure I set this on all my blogs from now on.
on May 22nd, 2007 at 7:57 am
Hello, I’m using Georgian language (UTF-8) and it has errors with encoding URL-s. can you help me?
on May 26th, 2007 at 9:27 pm
This makes sense to me, except what happens if I have named pages, which aren’t necessarily categories?
I’m new to blogs, just installed WordPress this afternoon, but want to have an “About” and “Contact” pages which are found through the links http://www.mysite.com/about and http://www.mysite.com/contact.
How does your rewrite method affect how those pages are referenced?
on May 26th, 2007 at 10:21 pm
If a file or folder exists, it is display. Noticed the REQUEST_FILENAME param. There are two of them in the rewrite statement. One !-f for file and one !-d for directory. This tells the web sever that if a file or directory exists, skip the rewrite rule.
on May 26th, 2007 at 10:28 pm
By the way. We have been using this technique on the site for awhile now. We haven’t really had any problems with it. Except (if you guy’s noticed) we used an apostrophe in the title for this post. As you can see in th URL it doesn’t like the apostrophe and it makes the URL look messy. It is kind of funny that the only page on this site with a bad URL is the one about cleaning your URL’s.
on May 27th, 2007 at 11:04 pm
Thanks John for the quick response! I’m moving along with my WordPress site. Sure helps to have sites like yours with good advice to answer my questions.
on July 1st, 2007 at 9:12 am
it seems that apostrophes in permalink is a wordpress bug, maybe the list of special characters that get sanitized should be updated, look:
http://trac.wordpress.org/ticket/3843
on March 15th, 2008 at 3:25 am
What if an article has two categories? How will be the URL of this article?