We often get asked how to set up certain WordPress settings here at Themify. We thought it would be a good idea to provide some tutorials on how to get started with some of WordPress' features outside of themes. Here is an in-depth tutorial on how to set your WordPress permalinks. To note: A permalink is a link or URL that points to a specific post or page entry.
WordPress Default URLs
The default structure of a permalink uses the post ID as a unique identifier in the url: http://example.com/?p=23
If you're happy with this then you're good to go. But it you're like most people and you want to spice things up a bit more, keep reading on.
Customizing your URLs
To change the default structure to something thats a bit more friendlier and more readable, go to Settings > Permalinks. There you should see a screen that looks something like the image below. In this example we've already chosen to use a "Custom Structure" for our links but you can choose one of the other defaults available if you want.
Available Permalink Tags
If you've chosen to use a "Custom Structure" then there are some useful tags available to you:
- %year% = the year of the post (eg. 2010)
- %monthnum% = month of the year (eg. 08)
- %day% = day of the month (eg. 25)
- %hour% = hour of the day (eg. 16)
- %minute% = minute of the hour (eg. 29)
- %second% = second of the minute (eg. 12)
- %postname% = post slug (post title)
- %post_id% = the ID of the post
- %category% = category slug of where the post is stored
- %author% = author name
You can use these tags listed to customize your permalink like we have in the image example above. Make sure to end your custom URL structure with either %post_id%
or %postname%
so WordPress has a unique identifier to point to. Here are some good examples of common, custom, permalink structures:
- /%category%/%postname% =
yoursite.com/category/post-title
- /%post_id%/%postname% =
yoursite.com/23/post-title
- /%year%/%postname% =
yoursite.com/2010/post-title
Adding to your URLs
You can also add a string, including file extensions, to the end of the url as seen in the examples below:
- /%category%/%postname%/ =
yoursite.com/category/post-title/
(forward slash added)
- /%category%/%postname%.html =
yoursite.com/category/post-title.html
- /%category%/%postname%.php =
yoursite.com/category/post-title.php
You can, technically, add anything to the end of the URL and WordPress will interpret it properly. This is useful if you are migrating from a static html site and you want to keep the old URL structure.
Categories & Tags
By default WordPress uses "category
" and "tag
" as the base name for the category and tag archives respectively. You can rename these under the permalink settings as well. A good example of why you might change these base names would be if your blog was all about cars. It would look a lot nicer if you changed the category base name to "car" and the tag base to "model". This way your category URL structure will look something like yoursite.com/car/category-slug
and the tag URL structure would be yoursite.com/model/tag-slug
. Here's what those settings would look like:
.htaccess File
What happens when you've set this all up but its not working? In most cases, you are probably missing the .htaccess
file in the root of your WordPress install. Open up your FTP client, connect to your server and make sure that there's a .htaccess
file and that it contains the following code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Reference: for more information about WordPress permalinks, visit WordPress codex.