URL Rewriting in WordPress

Your best bet for an easy solution is to actually use the “Custom Structure” option in your WordPress admin under Settings > Permalinks.

There are a number of other structure tags you may use as seen in the Codex.

If you’re looking for even more customization and manual control, it’s actually a pretty complex topic involving editing your .htaccess file. This great two part tutorial by Stephan Harris covers this topic very well. (Better than I ever could here on SO).