WP AI Agent
Features Pricing Blog Contact Download Plugin Manage Subscription Get Free Key →

How to Set Up WordPress Permalinks: Complete Step-by-Step Guide

· · 10 min read

Setting up WordPress permalinks correctly is one of the most important configuration steps you can take when launching or optimising a WordPress website. Permalinks determine the URL structure of every page, post, and archive on your site — and getting them right from the start has a direct impact on search engine rankings, user experience, and the overall professionalism of your site. In this guide, you will learn exactly how to configure, customise, and troubleshoot WordPress permalinks using both the dashboard and advanced methods.

What Are WordPress Permalinks and Why Do They Matter?

A permalink (short for "permanent link") is the full URL that points to a specific piece of content on your WordPress site. For example, a permalink might look like https://yoursite.com/blog/how-to-bake-bread/ or the less readable default https://yoursite.com/?p=123.

The structure you choose affects several critical areas:

  • SEO: Search engines like Google use URL keywords as a ranking signal. A descriptive permalink such as /best-running-shoes/ is more likely to rank than /?p=42.
  • User trust: Visitors are more likely to click on a link they can read and understand.
  • Shareability: Clean URLs are easier to share on social media, in emails, and in print.
  • Site architecture: A logical URL structure helps both users and search engine crawlers navigate your content hierarchy.

WordPress ships with several built-in permalink structures and also allows fully custom formats — giving you complete control over how your URLs appear.

How to Set Up WordPress Permalinks in the Dashboard

The quickest and most straightforward way to configure your permalink structure is through the WordPress admin panel. Follow these steps carefully:

  1. Log in to your WordPress admin area at https://yoursite.com/wp-admin.
  2. In the left-hand navigation menu, hover over Settings and click Permalinks.
  3. You will see the Permalink Settings screen, which lists all available permalink structures.
  4. Select the radio button next to the structure that best suits your site (see the options explained below).
  5. If you choose Custom Structure, type your desired format in the text field provided.
  6. Scroll down to review the optional Category base and Tag base fields if you want to customise those URL segments.
  7. Click Save Changes. WordPress will automatically attempt to update your .htaccess file.

After saving, WordPress redirects you back to the same Permalinks page and displays a confirmation message. Your new URL structure is immediately active across the entire site.

Understanding the Built-In Permalink Structure Options

WordPress offers six default options in the Permalink Settings screen:

  • Plain: /?p=123 — The default after installation. Not recommended for live sites.
  • Day and name: /2024/06/15/sample-post/ — Useful for news or date-heavy sites.
  • Month and name: /2024/06/sample-post/ — Similar to above, but less granular.
  • Numeric: /archives/123 — Slightly cleaner than plain but still not descriptive.
  • Post name: /sample-post/Recommended for most sites. Clean, keyword-rich, and SEO-friendly.
  • Custom Structure: Build your own format using the available structure tags.

Choosing the Right Permalink Structure for Your Site Type

Not every site has the same needs. Here are some practical recommendations:

  • Blog or business site: Use /%postname%/ (Post name). It is clean, readable, and widely considered the best option for SEO.
  • News publication: Consider /%year%/%monthnum%/%postname%/ to provide temporal context for articles.
  • Portfolio or agency site: /%postname%/ keeps URLs short and professional.
  • E-commerce (WooCommerce): /%postname%/ is generally best; WooCommerce will prepend /product/ automatically for product pages.

Using Custom Permalink Structure Tags

If you select Custom Structure, WordPress provides a set of structure tags you can combine freely. These are special placeholders that WordPress replaces with real data for each post or page.

Available Structure Tags

  • %year% — The post's year of publication (e.g., 2024).
  • %monthnum% — Month number (e.g., 06).
  • %day% — Day of the month (e.g., 15).
  • %hour%, %minute%, %second% — Time components.
  • %post_id% — The unique numeric post ID.
  • %postname% — The post's URL slug derived from its title.
  • %category% — The post's category slug.
  • %author% — The post author's username.

A common custom structure that includes category context is /%category%/%postname%/, producing URLs like /technology/best-laptops-2024/. This is particularly effective for sites with clearly defined content silos.

Setting Custom Category and Tag Bases

At the bottom of the Permalink Settings screen, you can also define custom base slugs for category and tag archive pages. For example, entering topics in the Category base field changes category URLs from /category/news/ to /topics/news/. Leave these blank to use the WordPress defaults.

Setting WordPress Permalinks with WP-CLI

If you manage WordPress via the command line — or if you are automating deployments and server setups — WP-CLI provides a fast and reliable way to configure permalinks without touching the dashboard.

Flushing and Setting the Permalink Structure

Use the following commands to set and flush your permalink structure from the terminal:

# Set the permalink structure to Post name (recommended)
wp option update permalink_structure '/%postname%/'

# Flush the rewrite rules so the new structure takes effect
wp rewrite flush --hard

# Verify the current permalink structure
wp option get permalink_structure

The --hard flag on wp rewrite flush forces WordPress to regenerate the physical .htaccess file, which is important on Apache-based servers. If you are running Nginx, you will need to update your server block configuration manually (see the troubleshooting section below).

Automating Permalink Setup in Deployment Scripts

Many developers include WP-CLI permalink commands in post-deployment scripts to ensure consistent URL structures across staging and production environments. Adding these two lines to your deploy script eliminates the need to log in to each environment's dashboard after every deployment.

Troubleshooting Common WordPress Permalink Problems

Even after correctly saving your permalink settings, you may encounter issues. Here are the most common problems and how to resolve them.

404 Errors After Changing Permalinks

This is the most frequently reported permalink issue. If every page on your site returns a 404 error after you change the permalink structure, the most likely cause is that the .htaccess file was not updated correctly.

  1. Navigate to Settings → Permalinks in your dashboard.
  2. Without changing anything, click Save Changes. This forces WordPress to regenerate the rewrite rules.
  3. If the problem persists, check that your .htaccess file in the WordPress root directory is writable by the web server.
  4. Manually verify that the file contains the standard WordPress rewrite block (see below).

The standard WordPress .htaccess block that must be present looks like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If this block is missing or corrupted, paste it manually into your .htaccess file and save.

Permalink Issues on Nginx Servers

Nginx does not use .htaccess files. Instead, pretty permalinks require a try_files directive in your Nginx server block configuration. Confirm the following line exists inside your location / block:

location / {
    try_files $uri $uri/ /index.php?$args;
}

After editing the Nginx configuration, restart the service with sudo systemctl restart nginx for the changes to take effect.

mod_rewrite Not Enabled on Apache

Pretty permalinks on Apache depend on the mod_rewrite module being active. If it is not enabled, every non-plain URL will return a 404. Enable it with:

sudo a2enmod rewrite
sudo systemctl restart apache2

Also ensure that your Apache virtual host configuration contains AllowOverride All for the WordPress document root directory; otherwise .htaccess directives will be ignored.

Changing Permalinks on an Existing Site with Existing SEO

Changing your permalink structure on an established site can break existing inbound links and cause temporary ranking drops. If you must change the structure, always implement 301 redirects from old URLs to new ones. The Redirection plugin is a popular free option that can manage this automatically by detecting URL changes.

Best Practices for WordPress Permalink Management

Following a few key best practices will save you time and prevent common mistakes:

  • Choose your structure before launch. Changing permalinks on a live site requires redirect management. Make the decision early.
  • Keep URLs short and descriptive. The post name structure is almost always the best choice. Avoid including dates unless your content is highly time-sensitive.
  • Edit post slugs individually when needed. Even with a global structure set, you can edit the slug of individual posts in the Block Editor by clicking on the URL field under the Summary panel in the document sidebar.
  • Use lowercase letters and hyphens only. Avoid underscores, spaces, or special characters in slugs. WordPress handles this automatically for new posts, but watch for manual entries.
  • Do not change post slugs arbitrarily after publishing. Each change requires a redirect to preserve link equity and existing traffic.
  • Flush rewrite rules after installing new plugins. Plugins that register custom post types or taxonomies may require a permalink flush to work correctly. Visit Settings → Permalinks and click Save Changes after installing such plugins.

Frequently Asked Questions

What is the best permalink structure for WordPress SEO?

The Post name structure (/%postname%/) is widely considered the best permalink structure for SEO. It produces short, descriptive, keyword-rich URLs without unnecessary date or ID segments. Most SEO professionals and Google's own documentation favour clean URLs that reflect the content of the page.

Will changing my WordPress permalink structure hurt my SEO?

Changing permalinks on a live site with existing traffic can cause a temporary dip in rankings if old URLs start returning 404 errors. To minimise the impact, implement 301 (permanent) redirects from all old URLs to their new equivalents immediately after making the change. Most ranking recovery occurs within a few weeks once Google re-crawls the redirected URLs.

Why are my WordPress permalinks showing 404 errors after I changed them?

404 errors after a permalink change are almost always caused by the .htaccess file not being updated. Go to Settings → Permalinks and click Save Changes again to regenerate the file. If that does not work, check that the file is writable by the server, that mod_rewrite is enabled (Apache), or that your Nginx config includes the correct try_files directive.

Do I need to flush WordPress permalinks after installing a new plugin?

Yes, especially if the plugin registers custom post types or custom taxonomies. WordPress needs to rebuild its internal rewrite rule table to include the new URL patterns. Simply visit Settings → Permalinks and click Save Changes — no need to alter any settings — or run wp rewrite flush via WP-CLI.

Configuring WordPress permalinks is a straightforward but consequential task that shapes your site's SEO foundation for years to come. By following the steps and best practices in this guide, you can confidently set up the right URL structure for any WordPress project. If you prefer to skip the manual steps entirely, WP AI Agent is a powerful tool that lets you manage WordPress tasks like configuring permalinks, flushing rewrite rules, and much more through a simple natural-language AI chat interface — no dashboard navigation required.

Ready to manage WordPress with AI?

Get 100,000 tokens free every month. No credit card required.

Get Your Free License Key →

More from the blog