- July 1, 2015
- Leave a comment
Permalinks are the permanent links to WordPress posts, pages and archives. Permalinks are what users type in their address bar to access any article within your WordPress blog. Search engines use them to link to the content on the website.
There are basically three types of permalinks:
1- Ugly Permalinks:
These are the types of permalinks which are used by default when a new WordPress is setup:
Here N is the ID of the post. It works in almost all server environments.
2- mod_rewrite (Pretty Permalinks):
These are the most commonly used types of permalinks. There are many different permalinks formats which can be achieved using the apache mod_rewrite, for example:
Here the “post-name” is the slug part of the post which is shown in the post listing or edit screen.
PATHINFO very much looks like pretty permalinks with an exception of /index.php added in the URL:
Choosing The WordPress Permalink Structure:
You can choose your permalink structure within Settings → Permalinks panel. You can choose any common structures or you can enter your own permalink structure under “Custom Structure”.
You need to make sure that you do not use your website URL within the custom structure slot, rather you should use structure tags or combination of the such tags only. Also if you want to use PATHINFO type of permalink structure, you should use index.php/ along with the structure tags that you want to include in your permalinks.
WordPress provide several different types of structure tags, which are listed below:
- %year% – The year of the post, four digits, for example 2004
- %monthnum% – Month of the year, for example 05
- %day% – Day of the month, for example 28
- %hour% – Hour of the day, for example 15
- %minute% – Minute of the Hour, for example 43
- %second% – Second of the minute, for example 33
- %post_id% – The unique ID # of the post, for example 423
- %postname% – A sanitized version of the title of the post (post slug field on Edit Post/Page panel). So “This Is A Great Post!” becomes this-is-a-great-post in the URL
- %category% – A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URL
- %author% – A sanitized version of the author name