An Introduction to WordPress Permalinks

    Jérémy Heleine
    Jérémy Heleine

    Website owners typically want readers to share their content either on their own sites or on social networks. To do this, readers need a link to share.

    What is a WordPress Permalink?

    A ‘permalink’ is a ‘permanent link’ to a specific page or post on a website. When you share a link, you expect that it won’t change and will be a permanent resource.

    WordPress generates a permalink for each post or page you create, which can be edited.

    There are several types of permalinks that WordPress uses. In this article, I’ll provide an introduction to permalinks, so that you’ll be able to choose the best type for your WordPress site.

    Each post or page you create has a unique identifier, called the ID. It’s a number that can uniquely identify your posts or pages, so it’s perfect for a default permalink system, and it’s the one chosen by WordPress.

    Let’s assume that you write a post that has the ID 308. Then, its default permalink will be By definition, the ID is unique, so by accessing the value of the p tag contained in the URL, WordPress will know which post to retrieve.

    It’s a simple system that has a big advantage: it can work on any server, so anyone can use it. However, these permalinks are ugly and not really explicit, and that’s why pretty permalinks exist.

    Pretty permalinks (also known as search friendly URLs) typically contain several words, like the title of the post they refer to. For example, This way, we can get an understanding of what the content of the page or post will be just by reading the URL. Furthermore, it will also be readable by search engines which in turn can help with search engine rankings.

    To enable pretty permalinks, go to the Settings > Permalinks menu in your WordPress dashboard. There you’ll find several options available where you can choose for the structure of the permalinks.

    The ‘ugly permalinks’ option is the default configuration, with the p parameter. The other options available are ‘pretty permalinks’, you can see in the examples on-screen what information is used. If you don’t like the options WordPress offers, you can even choose the structure you want with the last option ‘Custom Structure’.

    You can add any text you want in this structure (but be sure to only use URL-friendly characters!). Some tags allow you to include details like the year of the post, or its title. These tags are called ‘structure tags‘, a term used to describe the variables used in permalinks. Note that this is not to be confused with the standard WordPress ‘tags’ that you use to help categorise your content.

    Your structure can specify the date and time of the post. The year of the post is available with the %year%. Include the month with %monthnum% and the day with %day%. The time of the post is available with %hour%, %minute% and %second%.

    Two tags allow you to add more information about the post: the category with %category% and the author with %author%. For a post with multiple categories, only one will be included by using %category%: the first one, in alphabetical order.

    Finally, we find two important tags: %post_id% and %postname% which refer, respectively, to the post ID and the post title. Note that %postname% doesn’t include the exact post title: instead, it’s the slug which is included, a string representing the title, but only with URL-friendly characters.

    If you choose a custom structure, you must include the %post_id% or the %postname% tag or both. Without one of these tags, you can’t be sure that there will be only one post for each URL.

    Let’s take an absurdly long example to show what’s possible. To add the date, the time, and the author of a post, we can choose the following structure:


    and we will get URLs like the following one

    Categories and Tags

    Pretty permalinks are not only for your posts. In fact, they are also useful for your categories, tags and archives’ pages. If you choose any other option than ‘ugly permalinks’ for your post URLs, WordPress will automatically enable pretty permalinks for these pages.

    You’ll then have URLs like for your categories, instead of by default. For your tags, the tag slug will be prefixed by /tag/. For archives, you’ll get virtual directories like for instance. You can choose the prefix you want for your categories and tags, by filling the fields in the ‘Optional’ section.

    Editing the .htaccess

    To work, pretty permalinks uses a .htaccess file. This file must be at the root of the WordPress installation. It redirects all the visitors’ queries to the index.php file that interprets them and displays the right page.

    If WordPress can edit the .htaccess file itself, all you have to do is hit the ‘Save Changes’ button in Settings > Permalinks to enable pretty permalinks. However, in some cases (which depends on your hosting configuration), WordPress can’t edit it, so you’ll have to do it yourself.

    If this is the case, you’ll see a message at the bottom of the Permalinks page, indicating that you must edit the .htaccess file. If you don’t have a .htaccess file at the root of your WordPress installation, create it and then copy the contents of the text area WordPress gives you. If this file already exists, append the content displayed on-screen to the file using a text editor.

    There are some cases that disallow you to use pretty permalinks. In fact, if you can’t use .htaccess files, pretty permalinks won’t be available for you. The good news is that it doesn’t mean that you’ll have to use ugly permalinks forever.

    WordPress provides an intermediate option: the ‘almost pretty’ permalinks. These permalinks are prefixed by /index.php/. Except for this detail, they are similar to pretty permalinks, giving you the same options and tags. For instance, to use our example above (which is too big) with ‘almost pretty permalinks’, you can fill the ‘Custom Structure’ field with:


    You’ll then get URLs like:

    This is all without the need of a .htaccess file.

    As for pretty permalinks, if you enable ‘almost pretty permalinks’, your categories, tags and archives pages will also get almost pretty URLs. Once again, they’ll have the same structure as the pretty permalinks, but prefixed with /index.php/.

    Editing a Post Slug

    If you use the %postname% tag in your permalinks structure, you can customize even more of your URLs. For each post, you can edit the slug that WordPress generates.

    By default, WordPress takes the title and converts it to only use URL-friendly characters. For instance, spaces are converted into dashes, and special characters are also converted, or simply removed: ‘é’ will become ‘e’, ‘à’ will become ‘a’, and ‘?’ or ‘!’ will be removed, for example.

    WordPress doesn’t remove small words such as ‘the’ or ‘for’, known as ‘stop words’. These words are not very meaningful in URLs, and you may want to remove them. It’s possible to do that, post by post.

    It’s worth mentioning that several SEO plugins automatically take care of removing stop words, so you might already have this functionality on your site. Amit Diwan has a great article reviewing the popular SEO plugins.

    Below the Editor’s field for the post title you can read the generated permalink of the post. Next to this link, there’s a button labelled ‘Edit’, which allows you to edit the post permalink.

    Once you edit the field with your new slug, hit the ‘Ok’ button. Note that WordPress will ensure that your new URL is valid by creating the slug using the text you entered. If you entered ‘Hello World!’, then you’ll get ‘hello-world’, for example.

    editing permalink


    Pretty (or almost pretty) permalinks are useful for readable and SEO-friendly URLs. They can contain useful information such as the date of the post or its title. These permalinks are highly customizable and you can choose any structure you want for your website.

    Note that you should take your time in choosing a structure. For instance, if you change the structure for your posts, the old URLs will all produce 404 errors which would then all need to be redirected. It’s preferable not to change them for search engines, or people who have shared links to your posts on forums for example.

    What are the benefits of using pretty permalinks in WordPress?

    Pretty permalinks, also known as SEO-friendly URLs, are a crucial aspect of any WordPress website. They not only make your URLs look clean and readable but also enhance your site’s SEO. Search engines prefer URLs that are easy to read and understand. They use these URLs to determine the content of your page. Therefore, using pretty permalinks can improve your site’s ranking on search engine results pages (SERPs). Additionally, pretty permalinks are more user-friendly, making it easier for visitors to remember and type your URL into their browser.

    How can I customize my WordPress permalinks?

    WordPress allows you to customize your permalinks easily. Navigate to your WordPress dashboard, then go to Settings > Permalinks. Here, you’ll find several options, including Plain, Day and name, Month and name, Numeric, Post name, and Custom Structure. You can choose any of these options based on your preference. If you want to create a custom structure, you can use tags like %postname%, %year%, %monthnum%, %day%, %hour%, %minute%, %second%, %post_id%, %category%, %author%, and %pagename%.

    Why are my WordPress permalinks not working?

    If your WordPress permalinks are not working, it could be due to several reasons. One common issue is the .htaccess file. This file might be missing or not writable. To fix this, you can manually update the .htaccess file through FTP. Another reason could be conflicting plugins. Try deactivating all your plugins and then reactivate them one by one to identify the problematic plugin. If none of these solutions work, it might be a problem with your hosting provider. In this case, you should contact your hosting provider for assistance.

    How can I make my WordPress permalinks SEO-friendly?

    To make your WordPress permalinks SEO-friendly, you should use a structure that includes keywords related to your content. The most recommended structure is the Post name (%postname%) as it allows you to use your post or page title in the URL. This way, search engines and users can easily understand what your page is about just by looking at the URL. Also, try to keep your URLs as short as possible. Long URLs can be difficult for users to remember and may not display fully in search engine results.

    Can I change the permalinks of my existing posts?

    Yes, you can change the permalinks of your existing posts. However, changing the permalinks of published posts can lead to broken links, which can negatively impact your SEO. To avoid this, you should set up a 301 redirect from the old URL to the new one. This way, any visitor who clicks on the old URL will be automatically redirected to the new one. You can use plugins like Redirection or Simple 301 Redirects to easily set up 301 redirects.

    What is the difference between a permalink and a slug in WordPress?

    In WordPress, a permalink is the entire URL used to access a specific post, page, or other pieces of content on your website. On the other hand, a slug is the part of the URL that identifies a particular page in an easy-to-read form. It’s the part of the permalink that you can customize in WordPress when creating or editing a post or page.

    How can I include categories in my WordPress permalinks?

    To include categories in your WordPress permalinks, you can use the %category% tag in the Custom Structure option. For example, you can set your custom structure to /%category%/%postname%/ to include the category name and the post name in your URLs. However, keep in mind that if a post belongs to multiple categories, WordPress will only include one category in the URL, and it will choose the category based on the alphabetical order.

    What should I do if I get a 404 error after changing my permalinks?

    If you get a 404 error after changing your permalinks, it’s likely that your .htaccess file didn’t update correctly. To fix this, you can manually update your .htaccess file. First, connect to your website using an FTP client. Then, locate the .htaccess file in your website’s root directory. Open the file and make sure it contains the necessary WordPress rewrite rules. If you’re not comfortable editing the .htaccess file, you can also try saving your permalinks again. Simply go to Settings > Permalinks and click on the Save Changes button without making any changes.

    Can I use special characters in my WordPress permalinks?

    While WordPress allows you to use special characters in your permalinks, it’s not recommended. Special characters can cause issues with certain browsers and servers, and they can make your URLs difficult to read. Instead, you should stick to alphanumeric characters (letters and numbers) and hyphens. Avoid using spaces, underscores, and other special characters.

    How can I set up pretty permalinks in WordPress Multisite?

    Setting up pretty permalinks in WordPress Multisite is similar to setting them up in a regular WordPress installation. However, there are a few additional considerations. First, you need to make sure that your server supports mod_rewrite, which is necessary for pretty permalinks to work. Second, you need to update your .htaccess file with the necessary rewrite rules. These rules are slightly different for Multisite installations. You can find the correct rules in the Network Setup screen in your WordPress dashboard.