WordPress Permalinks: Settings, Best Structure, Safe Changes

Your WordPress permalink settings live under Settings > Permalinks. For almost every site, pick Post name (/%postname%/) and click Save Changes. If the site already has traffic, set up redirects first: a new structure changes every post URL, and on a clean WordPress 7.1.4 install, core did not redirect the most common switch (the date-based default to Post name) on its own.

A permalink is the permanent URL for a post, page, category, tag, or archive. It’s what people copy when they share your article, what Google indexes, and what every internal link points to. Get the structure right early and you barely think about it again.

This guide covers every option on the Permalinks screen, which structure to pick, exactly which old URLs break when you change it (tested), how to flush rewrite rules, and the fixes for the usual 404 problems.

Key Takeaways
  • Permalinks are the permanent URLs for your posts and pages, set under Settings > Permalinks.
  • “Post name” (/sample-post/) is the best default for most sites: clean, readable, and SEO-friendly.
  • New installs start on “Day and name” when the server supports pretty permalinks, and Plain only when it doesn’t.
  • Changing the structure on an established site changes every post URL. Core only redirects some of those changes, so add your own 301s first.
  • If custom post types or new pages 404, re-save permalinks (or run wp rewrite flush --hard) to flush the rewrite rules.

What Is a WordPress Permalink?

“Permalink” is short for permanent link. It’s the full URL that points to a specific resource on your site and doesn’t change over time (unless you change it). The permalink for this post is https://smartwp.com/wordpress-permalinks/. The /wordpress-permalinks/ part is the slug, and the rules that turn that slug into a real page request live in your permalink structure.

Under the hood, WordPress doesn’t actually have a folder called /wordpress-permalinks/. Every request to that URL gets routed through index.php, which looks at the URL, matches it against WordPress’s internal rewrite rules, figures out which post to load from the database, and returns the page. The .htaccess file (on Apache) or the equivalent server config (on Nginx) is what tells the server to hand all those pretty URLs to index.php in the first place.

You don’t need to understand any of that to use permalinks. But it helps later when you hit the inevitable “my permalinks aren’t working” issue.

The 6 WordPress Permalink Structures

Go to Settings > Permalinks in your WordPress admin. In WordPress 7.1 the screen has two parts. Common Settings holds 5 preset structures plus Custom Structure, with clickable buttons for the available tags. Optional holds the Category base and Tag base fields. WooCommerce and some other plugins add their own sections below those. Nothing applies until you click Save Changes.

Here are the 6 structure options:

Comparison table of the 6 WordPress permalink structures (Plain, Day and Name, Month and Name, Numeric, Post Name, Custom) with example URLs and best-use cases, with Post Name highlighted as the recommended option

1. Plain

Format: yoursite.com/?p=123

Plain uses query strings instead of pretty URLs. It works on any server with zero configuration (no .htaccess, no Nginx rewrites) but it’s bad for shareability and tells visitors and search engines nothing about the page. Google’s URL guidelines recommend readable words over ID numbers in URLs. Avoid it.

Plain is only the fallback. During installation, WordPress tries the Day and name structure, requests the default Hello World post, and keeps that structure if the request comes back with the expected X-Pingback header (that’s wp_install_maybe_enable_pretty_permalinks() in core). Plain is set only when that test fails, which usually means rewrites aren’t working on the server.

2. Day and Name

Format: yoursite.com/2026/05/08/sample-post/

Includes year, month, day, and slug. This is what a new WordPress install starts with (a fresh 7.1.4 install reported /%year%/%monthnum%/%day%/%postname%/), so if you never touched the setting, you’re probably on it. Good for news sites where readers care which day a story dropped. Bad for evergreen content: an old date in the URL makes a still-accurate post look outdated in search results.

3. Month and Name

Format: yoursite.com/2026/05/sample-post/

Same idea as Day and Name but without the day. Still bakes the publish month into every URL, which still hurts evergreen content. Useful for news magazines that publish monthly issues or sites where the month is genuinely part of the identity. For everyone else, skip it.

4. Numeric

Format: yoursite.com/archives/123

Replaces the slug with the post ID. About as user-hostile as Plain, just slightly prettier on the surface. There’s no scenario where this is the best pick.

5. Post Name (recommended)

Format: yoursite.com/sample-post/

Just the slug. Clean, short, descriptive, evergreen, easy to share, easy to remember. This is the right choice for most WordPress sites: blogs, portfolios, business sites, documentation, and almost anything that isn’t a date-driven news outlet. If you’re not sure which to pick, pick this one.

6. Custom Structure

Format: anything you want, built from structure tags like %postname%, %category%, %year%, etc.

Custom is where you go when none of the above fits. Common picks:

  • /%category%/%postname%/ for sites where the category adds useful context (a recipes site might want /desserts/chocolate-cake/).
  • /blog/%postname%/ if you want all posts under a single prefix so the rest of your site can use top-level pages without colliding with post slugs.
  • /%year%/%postname%/ if you want a year but not month/day (useful for annual-archive sites).

Be careful with %category%: a post in multiple categories will only use one in the URL (WordPress uses the category with the lowest term ID, which is usually but not always the one you’d expect), and changing a post’s category later changes its URL, which breaks the link. For most sites, the extra category context isn’t worth the maintenance overhead.

Which Permalink Structure Should You Use?

Short answer for 80% of WordPress sites: Post Name (/%postname%/).

The longer version, by site type:

  • Blogs and content sites: Post Name. Short, evergreen, shareable.
  • News sites: Day and Name if the date is genuinely part of the story (breaking news, sports scores, market reports). Otherwise still Post Name and put the date inside the article instead.
  • Ecommerce / WooCommerce: Post Name for blog content, with the WooCommerce permalink settings (Settings > Permalinks > Product permalinks) controlling product URLs separately. The options are Default (/product/sample-product/), Shop base (/shop/sample-product/), Shop base with category (/shop/product-category/sample-product/), and a custom base.
  • Documentation sites: Post Name, or a custom structure like /docs/%postname%/ if you want all docs under one prefix.
  • Niche sites with strong category logic: /%category%/%postname%/, but only if your categories are stable. If you’re going to recategorize posts later, stick with Post Name.

Available Structure Tags

If you’re building a custom structure, these are the tags WordPress recognizes:

  • %postname%: the slug (e.g., sample-post)
  • %year%: the 4-digit year (e.g., 2026)
  • %monthnum%: the 2-digit month (e.g., 05)
  • %day%: the 2-digit day (e.g., 08)
  • %hour%, %minute%, %second%: for anyone who really needs second-precision URLs (you probably don’t)
  • %post_id%: the database post ID (e.g., 123)
  • %category%: the category slug (lowest term ID if the post has several; sub-categories show as nested folders like /recipes/desserts/)
  • %author%: the author’s slug (useful on multi-author sites, risky if authors leave)

End your custom structure with a trailing slash. WordPress only rejects a custom structure that has no structure tag at all, with the error “A structure tag is required when using custom permalinks.” It will accept something like /%year%/, but that can’t identify a single post, so always include %postname% or %post_id%.

How to Change Your Permalink Structure (Without Breaking Your Site)

Changing permalinks on a new site is harmless. On an established site, every post URL changes the moment you click Save. Some old URLs get redirected by core, many don’t, and the ones that don’t return a 404.

What core redirects on its own (tested on WordPress 7.1.4)

Test setup: a clean WordPress 7.1.4 install with no plugins and one post at /2026/05/08/sample-post/. Each row is one structure change, followed by a request for the old URL:

ChangeOld URL requestedResult
Day and name to Post name/2026/05/08/sample-post/404, no redirect
Post name to Day and name/sample-post/301 to /2026/05/08/sample-post/
Post name to /%category%/%postname%//sample-post/404, no redirect
/%category%/%postname%/ to Post name/zeta/sample-post/301 to /sample-post/
Post moved to another category (category structure)/tutorials/sample-post/301 to /zeta/sample-post/
Slug edited from sample-post to renamed-post/sample-post/301 to /renamed-post/
Category base changed to topic/category/tutorials/404, no redirect
Old-URL behavior after permalink changes on WordPress 7.1.4, no plugins.

The pattern comes from two core features. Slug edits are covered by the old-slug redirect: WordPress stores the previous slug in _wp_old_slug and redirects it. Everything else depends on redirect_guess_404_permalink(), which only runs when the old URL still parses into a post name. /sample-post/ does under a date structure, so core finds the post. /2026/05/08/sample-post/ doesn’t match any Post name rule, so it’s a plain 404.

Don’t lean on the guessing either. It’s a loose prefix match on the slug (post_name LIKE 'slug%'), and hosts or plugins can turn it off with the do_redirect_guess_404_permalink filter. Explicit 301s are the only thing you control. Google’s own advice for a changed URL is a permanent server-side redirect.

The safe workflow

  1. Back up your site. Files and database. Use UpdraftPlus, Solid Backups, or your host’s backup tool. Verify the backup actually downloads before you touch Settings > Permalinks.
  2. Export a list of your current URLs. Run wp post list --post_type=post --field=permalink > old-urls.txt from WP-CLI, or use a sitemap plugin to grab the full list. You’ll need this to test redirects later.
  3. Set up redirects before you change anything. The free Redirection plugin (John Godley, version 5.10.1, tested up to WordPress 7.1.4, 2+ million installs) has a Permalink Migration setting under Tools > Redirection > Site: enter your old structure and it redirects old post URLs to the current ones. The plugin labels it beta and says it only migrates posts. Its “Monitor changes to posts” option only fires when an individual post’s URL changes on save, so it won’t catch a site-wide structure change. A single regex redirect (below) is the dependable fallback.
  4. Change Settings > Permalinks. Pick your new structure, hit Save Changes. WordPress regenerates the rewrite rules and updates the database.
  5. Test 10-20 of your old URLs. Run curl -I on them or paste them into a browser. Each one should return a 301 to the new URL. Anything that 404s needs a redirect.
  6. Submit your updated sitemap to Google Search Console. Yoast SEO, Rank Math, or All in One SEO will regenerate it automatically. Submit the new sitemap URL and let Google re-crawl.
  7. Monitor Search Console for a few weeks. Watch the Page indexing report for new “Not found (404)” URLs and the Performance report for ranking changes. A sustained drop on specific pages usually means a redirect is missing.

Redirect Day and name URLs to Post name

Since Day and name is the install default, this is the switch most sites make. One pattern rule covers every post. In Redirection, add a redirect with the Regex option enabled, source ^/\d{4}/\d{2}/\d{2}/(.+)$ and target /$1. On Apache, the same rule in .htaccess, placed above the # BEGIN WordPress line so WordPress never overwrites it:

RedirectMatch 301 ^/\d{4}/\d{2}/\d{2}/(.+)$ /$1

On Nginx, inside the server block:

rewrite ^/\d{4}/\d{2}/\d{2}/(.+)$ /$1 permanent;

The pattern needs something after the date, so day archives like /2026/05/08/ keep working. For Month and name, drop one /\d{2}. Test a handful of old URLs after adding it.

Permalinks and Rewrite Rules: What’s Actually Happening

When you save a permalink structure on Apache, WordPress writes this block into .htaccess (this is the exact block WordPress 7.1.4 generates for a site in the root folder):

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

The rules say: if the requested URL isn’t a real file or directory, hand it to index.php. WordPress then takes over, parses the URL against its internal rewrite rules (stored in the wp_options table as rewrite_rules), finds the matching post, and renders the page.

The HTTP_AUTHORIZATION line passes the Authorization header through to PHP, which application passwords and other REST API authentication rely on. Older guides leave it out.

This is why “I changed my permalinks and now everything 404s” usually has the same fix: revisit Settings > Permalinks and click Save Changes, even without changing anything. The screen calls flush_rewrite_rules(), which rebuilds the rewrite_rules option and rewrites the .htaccess block if the file is writable. If it isn’t, WordPress shows “You should update your .htaccess file now.” and prints the rules for you to paste in.

For a deeper look at the .htaccess side, see our WordPress .htaccess guide. For the database side (and what other rewrite rules WordPress registers behind the scenes), the Rewrite API documentation on developer.wordpress.org is the canonical reference.

“Resetting” or “flushing” permalinks means rebuilding the rewrite rules. Your URLs don’t change. There are three ways to do it:

  • In wp-admin, go to Settings > Permalinks and click Save Changes without changing anything. This is a hard flush, so it also updates .htaccess when it can.
  • With WP-CLI, run wp rewrite flush. That only rebuilds the rules in the database. Add --hard to also update .htaccess (single-site installs only, per the WP-CLI docs).
  • In code, call flush_rewrite_rules() once, when your plugin is activated. The WordPress developer docs call it an expensive operation, so never run it on every page load.

For a plugin that registers a custom post type, this is the pattern from the flush_rewrite_rules() reference: register the post type, then flush on activation.

function myplugin_register_book() {
	register_post_type( 'book', array( 'public' => true, 'label' => 'Books' ) );
}
add_action( 'init', 'myplugin_register_book' );

function myplugin_activate() {
	myplugin_register_book();
	flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'myplugin_activate' );

Common Permalink Problems and Fixes

“My permalinks aren’t working” (everything 404s)

Go to Settings > Permalinks and click Save Changes, without changing anything. This regenerates the rewrite rules. That fixes most cases.

From the command line, the equivalent is wp rewrite flush --hard. Useful when you can’t reach wp-admin or when you’re scripting a deploy.

If neither of those works, check your .htaccess file actually exists in your WordPress root and contains the # BEGIN WordPress block shown above. On a fresh server, the file might be missing entirely, or the WordPress block might have been removed by a host or another plugin. If the block is there and posts still 404, Apache is probably ignoring the file: mod_rewrite isn’t enabled, or the site’s directory config has AllowOverride None. That one is for your host.

REST API returns 404 from /wp-json/

Same fix: Settings > Permalinks > Save Changes. The REST API registers its routes via the same rewrite-rules system, so anything that breaks the main permalink structure usually breaks REST routing too. If that doesn’t fix it, a security plugin (Wordfence, Kadence Security, etc.) is probably blocking /wp-json/ at the firewall level.

Pages work but custom post types 404

Custom post types register their own rewrite rules when WordPress loads. If you added a custom post type via code in functions.php or a plugin, the rewrite rules don’t take effect until WordPress regenerates them. Hit Save on Settings > Permalinks (yes, again) to force the flush.

Nginx: the homepage works but every post 404s

Nginx doesn’t read .htaccess, so saving Settings > Permalinks stores the option but can’t configure the server. The rule from the WordPress Nginx documentation goes in your site’s server block (often /etc/nginx/sites-available/yoursite.conf):

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

Run sudo nginx -t to check the config, then reload Nginx (sudo systemctl reload nginx). Managed hosts that run Nginx usually include this rule already, so if you’re on one, contact support instead of editing configs.

“A structure tag is required when using custom permalinks”

You picked Custom Structure and entered plain text with no %tag% in it, like /blog/. Add a tag, usually /blog/%postname%/, and save again.

Trailing slash vs. no trailing slash

WordPress defaults to trailing slashes (/sample-post/) and auto-redirects no-slash URLs to the slash version. You almost never need to change this. If you do (some developers prefer no trailing slash), it’s done via a filter in functions.php, not in Settings > Permalinks. Pick one and stick with it forever; flipping back and forth creates redirect chains that hurt page speed.

Permalinks for Custom Post Types and Categories

Settings > Permalinks controls posts and pages. Two other URL settings live on the same screen but are easy to miss:

  • Category base. The slug used for category archive URLs. Default is /category/, so a “Tutorials” category lives at yoursite.com/category/tutorials/. Change it to something shorter like /topic/ if you want, or leave it.
  • Tag base. Same idea for tags. Default is /tag/.

Leave either field blank to keep the default. Changing a base on a live site breaks every old archive URL: in the 7.1.4 test above, /category/tutorials/ returned a 404 after the base became topic, with no redirect. A regex redirect from ^/category/(.*)$ to /topic/$1 covers all of them. Core has no setting to remove the base entirely; that takes a plugin or custom rewrite code.

Custom post types and custom taxonomies registered via plugins or code have their own rewrite rules separate from these settings. WooCommerce, for example, exposes its own “Product permalinks” section further down the Settings > Permalinks screen that controls product URLs independently.

Frequently Asked Questions

What is the best permalink structure for SEO?

Post Name (/%postname%/) for almost every site. It’s short, descriptive, evergreen, and doesn’t bake the publish date into the URL. The only real exception is a news site where readers genuinely care which day a story dropped; in that case Day and Name is defensible. For everyone else, Post Name is the default answer.

What is the default permalink structure in WordPress?

Day and name (/%year%/%monthnum%/%day%/%postname%/). The installer tries it first and keeps it if a test request works; it falls back to Plain (?p=123) only when the server can’t handle rewrites. Most sites should switch to Post name right after installing, before anything is published.

How do I reset the WordPress permalinks?

Go to Settings > Permalinks and click Save Changes without changing anything, or run wp rewrite flush --hard. Both rebuild the rewrite rules without changing any URLs. To go back to a previous structure, select it again and save, then check that old URLs still resolve.

What’s the difference between a permalink and a URL?

A permalink is a URL. The term means the permanent, public URL WordPress assigns to a piece of content, as opposed to temporary ones like preview links or ?p=123 shortlinks. Every permalink is a URL, but not every URL is a permalink.

What is the purpose of permalinks in WordPress?

They give each post, page, and archive a stable, readable address. Readers can tell what a link is before they click it, search engines get descriptive URLs, and links shared elsewhere keep working as long as the permalink doesn’t change.

Will changing my permalinks hurt my SEO?

If you do it without 301 redirects, yes. Every existing URL becomes a 404, Google sees a wave of broken links, and rankings drop within days. With 301 redirects in place, Google follows them to the new URLs, but expect some movement while it recrawls. Back up first, add the redirects before you change the setting, and watch Search Console for the following weeks. If the numbers move and you are not sure what you are looking at, here is how to tell normal position fluctuation from a real ranking problem (on the blog of RightBlogger, another product I run).

Why do my WordPress permalinks return a 404?

The most common cause is that WordPress’s rewrite rules got out of sync with what’s in .htaccess. The fix is almost always the same: go to Settings > Permalinks and click Save Changes (without changing anything). That regenerates both. If that doesn’t fix it, the .htaccess file is either missing the WordPress rewrite block, or your server isn’t allowing .htaccess overrides (an Apache AllowOverride directive issue). On Nginx, you need the rewrite rules in your Nginx config; WordPress can’t write them for you.

Can I include the category in my URL?

Yes, with a custom structure of /%category%/%postname%/. The trade-off: a post in multiple categories will only show one in the URL (WordPress picks the category with the lowest term ID), and changing a post’s category later changes its URL (which breaks the link). For most sites the extra context isn’t worth the maintenance overhead, but for niche sites with stable, clearly-separated categories (recipes, tutorials, product categories), it can work well.

What’s the difference between a slug and a permalink?

The slug is the URL-friendly version of the post title (the sample-post part). The permalink is the full URL the slug lives inside (https://yoursite.com/sample-post/). You can edit a post’s slug independently in the post editor (right-side panel under URL) without affecting the overall permalink structure.

Does WordPress support permalinks without trailing slashes?

Yes, but not via Settings > Permalinks. WordPress defaults to trailing slashes and auto-redirects the no-slash version. To switch to no trailing slash, you need a filter in functions.php (search for the user_trailingslashit filter for examples). Pick one and stick with it; flipping back and forth creates redirect chains that hurt page speed.

How long should a WordPress permalink be?

There’s no hard limit to aim for. Google’s URL guidelines ask for simple, descriptive URLs with readable words, so cut filler words from the slug and keep the words that describe the page. With Post name, the slug is the whole path, which keeps URLs short anyway.

Do I need to use hyphens or underscores in slugs?

Hyphens. Google’s URL structure guidelines recommend hyphens instead of underscores because hyphens clearly signal a word boundary, while underscores are often used to join words (like format_date in code). WordPress defaults to hyphens when auto-generating slugs from post titles, so slugs come out in kebab case (lowercase words joined by hyphens); don’t switch to underscores.

Wrapping Up

Three things to remember and you’ll never wrestle with WordPress permalinks again: Post name structure for almost every site, redirects in place before you change the setting on an established site, and Settings > Permalinks > Save Changes as the first fix for “my permalinks broke” problems.

If you want to go deeper into what’s actually happening under the hood, the .htaccess guide covers the server-level side and the REST API guide covers how those same rewrite rules route the JSON endpoints under /wp-json/.

Picture of Andy Feliciotti

Andy Feliciotti

Andy has been a full time WordPress developer for over 15 years. Through his years of experience has built 100s of sites and learned plenty of tricks along the way. Found this article helpful? Buy Me A Coffee

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Tips Monthly
Get the latest from SmartWP to your inbox.