Prettifying a URL is an old technique. It is generally called URL Rewriting. Why should you do this? For one, it’s better to look at it. A URL that has “?s=1&sid=4752891&gn=0&.rand=99olqituu202iqzx37a6” after the domain name, can be quite confusing and unpleasant to look at for those who don’t understand it. Secondly, re-written URLs are more SEO-friendly and user-friendly as well. There are many more advantages to URL rewriting, and I won’t cover that here.
Being a WordPress noob, I knew I would be rewriting my URLs to look pretty. Luckily, WordPress has a built-in tool for this so us noobs won’t have to manually edit the .htaccess file by hand. This feature can be found in Dashboard –> Settings –> Permalinks.
Here are a few exmaples of the options already provided by WordPress.
Default – http://www.domain.com/?p=123
Day and Name – http://www.domain.com/2009/09/21/sample-post/
Month and Name – http://www.domain.com/2009/09/sample-post/
Numeric – http://www.domain.com/archives/123
The last one is the custom structure, where you have to put in what you want the URL to look like. Clicking on those radio buttons, you will see that the custom structure text field is filled out with something like,
/%year%/%monthnum%/%day%/%postname%/
which is the structure for the Day and Name option. Click on other options to see what comes out. These are already clues on how to customize your own URL. I made mine put the post name or page name after the domain. The structure is easy, it’s just like this,
/%postname%
This results in a URL that looks like these,
http://www.domain.com/how-to-cook-beef-stew
http://www.domain.com/about
Be careful with putting a trailing slash on the URL structure. The Day and Name example above has a slash at the end. This could confuse some browsers, such as Internet Explorer, thereby causing the dreaded 404 error.
This error may not be exclusive to WordPress permalink structures alone. It would seem that if you’re not very careful with the rules in your custom .htaccess file and you happen to have a trailing slash in it, chances are you will be getting 404 errors when browsing with IE.
Similar Posts:
- > Error: uncaught exception: Permission denied to call method XMLHttpRequest.open February 7, 2007
- > WordPress For Android December 9, 2010
- > unSnap it! February 22, 2007
- > WordPress: Show Posts of a Category in a Page August 18, 2020
- > Creating A Static Front Page With WordPress September 21, 2009