How to Set Up SEO-Friendly WordPress Permalinks

monitor screengrab
Photo by Stephen Phillips - Hostreviews.co.uk on Unsplash

What You Will Learn

  • The 'Post name' structure is the most SEO-friendly option because it is clean, short, and keyword-rich.
  • Always set up 301 redirects when changing permalinks on an existing site to prevent 404 errors and preserve search rankings.
  • Submit your updated XML sitemap to Google Search Console immediately after changing URLs to speed up re-indexing.

When you start a WordPress website, one of the most critical decisions you will make is choosing your URL structure. In WordPress, these permanent URLs are called permalinks. If your URLs look like random numbers, dates, or complicated codes, both search engines and human visitors will struggle to understand your content. To get the best search rankings, you must use SEO friendly WordPress permalinks. The ideal structure is clean, short, and contains your main keywords. In this step-by-step guide, we will learn how to set up the perfect permalink structure for a brand-new website. We will also cover how to safely change your permalinks on an existing website without losing your hard-earned search engine rankings or breaking your links. Let us do this step by step.

Prerequisites Before You Begin

Before we make any changes to your WordPress settings, let us prepare properly. Changing your URL structure changes how WordPress talks to your database and how web servers route traffic. To avoid any downtime or lost data, make sure you have the following ready:

Understanding WordPress URL Options

WordPress offers several default permalink structures out of the box. Let us look at these options in detail so you can make the best decision for your website.

Structure NameExample URL FormatSEO Friendliness
Plainexample.com/?p=123Poor (No keywords, hard for users to read)
Day and nameexample.com/2023/10/24/sample-post/Moderate (Good for news, bad for evergreen content)
Month and nameexample.com/2023/10/sample-post/Moderate (Includes dates which can make content look old)
Numericexample.com/archives/123Poor (No keywords, uses database IDs)
Post nameexample.com/sample-post/Excellent (Short, clean, keyword-rich)
Custom Structureexample.com/%category%/%postname%/Good (Useful for very large multi-category sites)

Why Some Structures Hurt Your SEO

Let us explain why some of these options are bad for your search engine optimization efforts:

  • The Plain Structure: This uses the database ID of the post. It gives absolutely no clues to search engines or users about what the page is about. Google crawlers prefer URLs that describe the page content.
  • Date-Based Structures (Day/Month and Name): These include the exact date the post was published. While this is fine for news websites that publish dozens of articles daily, it is bad for evergreen blogs. If you update an old post to make it fresh, the URL still shows an old year. This can lower your click-through rate in search results because users prefer recent content.
  • The Numeric Structure: Like the Plain structure, this lacks keywords and uses an archive ID. It does not help search engines categorize your content.

Why "Post Name" is the Best SEO-Friendly WordPress Permalinks Structure

Search engines use your URL to understand the topic of your page. A clean URL like example.com/how-to-bake-cake/ tells search engines exactly what to expect. When you use the "Post name" structure, you get three major benefits:

  1. Keyword Richness: You can easily include your primary keyword in the URL slug. This helps search engines match your page to user search queries.
  2. Better User Experience: Users are more likely to click on a link in search results or social media if they can read the URL and trust where it leads. A clean URL looks professional and secure.
  3. Easy Sharing: Clean URLs are easy to copy, paste, and share on social media platforms. They do not get cut off or look like spam.
The letters S, E, and O with patterned surfaces on a white background
Photo by Merakist on Unsplash

How to Set Permalinks on a New WordPress Site

If your website is brand new and has no published posts, setting up your permalinks is very simple. There is no risk of breaking existing traffic. Let us set this up step by step:

  1. Log in to your WordPress Admin Dashboard.
  2. On the left-hand menu, hover over Settings and click on Permalinks.
  3. Under the Common Settings section, you will see the list of options. Select the radio button next to Post name.
  4. If you want to use a custom structure like including the category, you can select Custom Structure and click the /%category%/%postname%/ tag buttons. However, for 95% of websites, the simple Post name option is the best choice.
  5. Scroll down to the bottom of the page and click the blue Save Changes button.

WordPress will automatically attempt to update your .htaccess file (on Apache servers) or configure the routing. This is a special configuration file on your web server that controls how URLs are redirected. Once saved, all your future posts and pages will automatically use the clean, SEO-friendly structure.

Changing Permalinks on an Existing Site (The Safe Migration Plan)

If your website has been live for months or years, changing your permalinks is a major task that requires extreme care. If you simply change the setting in WordPress, all your old URLs will immediately stop working. Visitors clicking on links from Google, social media, or other websites will see a "404 Page Not Found" error. This can destroy your search rankings and traffic.

To prevent this, you must set up 301 redirects. A 301 redirect is a permanent redirect that tells search engines and browsers that a page has moved to a new address. It passes almost all of the search engine ranking power (link equity) from the old URL to the new URL.

An Illustrative Example of a Safe URL Migration

Let us look at a concrete example. Suppose your old URL is:

https://example.com/2023/05/12/my-first-post/

You want your new URL to be:

https://example.com/my-first-post/

If you do not set up a 301 redirect, anyone visiting the old link will get an error. Here is how to migrate safely step by step:

  1. Install a Redirect Plugin: Install a free plugin like "Redirection" or use the redirect manager in an SEO plugin like Rank Math or Yoast SEO.
  2. Map Your Old URLs to New URLs: If you are changing from a date-based structure to "Post name", you can use a regular expression (Regex) redirect to map all old posts automatically. For example, in the Redirection plugin, you would add a new redirect with these settings:
    • Source URL: ^/\d{4}/\d{2}/\d{2}/([^/]+)/$
    • Target URL: /$1/
    • Match: URL only
    • Regex: Check the box to enable Regular Expressions
  3. Apply the Changes in WordPress: Go to Settings > Permalinks, select Post name, and click Save Changes.
  4. Test Your Redirects: Open a private browser window and try to visit one of your old URLs. It should automatically and smoothly redirect to the new clean URL.

Verifying and Indexing Your New URLs

Once your redirects are active, you must help search engines find and index your new URLs. This ensures your search rankings transition smoothly without a drop in traffic.

  1. Update Your XML Sitemap: Most WordPress SEO plugins (like Yoast, Rank Math, or All in One SEO) will automatically update your XML sitemap when you change your permalinks. An XML sitemap is a file that lists all the important URLs of your site so search engines can crawl them efficiently Build and Submit a Sitemap.
  2. Submit Your Sitemap to Google Search Console: Log in to Google Search Console, go to the "Sitemaps" section, and submit your updated sitemap URL . This tells Google to crawl your new URLs and update its index. Google supports the sitemap formats defined by the sitemaps protocol, and XML sitemaps are the most versatile .
  3. Monitor Your Indexing and Performance: Keep an eye on your Search Console reports. It will take some time for Google to replace the old URLs with the new ones in search results. Monitor your Core Web Vitals report in Search Console to ensure your pages continue to load quickly and perform well for real-world users Core Web Vitals Report. Also, if you use structured data on your pages to get rich results, verify that your schema markup is still working correctly on the new URLs Understand How Structured Data Works.
A blue laptop displaying the WordPress logo on a speckled blue surface
Photo by Deng Xiang on Unsplash

Common Mistakes to Avoid

When setting up or changing your WordPress permalinks, avoid these common errors:

  • Changing Permalinks Frequently: Every time you change your URL structure, you risk losing search traffic. Choose a structure and stick to it. Do not change it unless absolutely necessary.
  • Forgetting to Update Internal Links: While 301 redirects will send users to the right place, internal links on your own site should point directly to the new URLs. This saves server resources, improves page speed, and provides a better user experience.
  • Not Testing on Mobile: Always test your redirects on both desktop and mobile devices to ensure they work seamlessly across all platforms.
  • Leaving the Default "Plain" Structure: Never leave your site on the default plain structure if you want to rank in search engines. It is a major barrier to SEO success.

How to Verify Your Result

To ensure your new permalinks are working perfectly, perform these verification steps:

  1. Check HTTP Status Codes: Use a free online HTTP header checker tool. Enter your old URL. It should return a "301 Moved Permanently" status code, followed by a "200 OK" status code for the new URL. This confirms the redirect is set up correctly.
  2. Check for Redirect Loops: Ensure your old URL does not redirect to another redirect, creating a loop. It should be a direct, single-step redirect to the new URL.
  3. Check Your Live Pages: Click through your website's navigation menu, category pages, and homepage links to make sure every link loads without errors. If you see any 404 errors, double-check your permalink settings and redirect rules.

What to Do Next

Now that you have successfully set up your SEO-friendly permalinks, your next step is to update any hardcoded links in your older articles. Go through your top-performing posts and change any internal links that still point to the old URL format. This keeps your site fast and clean for both Google and your readers. If you run into any server errors during this process, check your server's .htaccess file permissions or contact your hosting provider for assistance.

Frequently Asked Questions

Will changing my WordPress permalinks hurt my SEO?

If you change your permalinks without setting up proper 301 redirects, it will severely hurt your SEO by creating broken links (404 errors). However, if you implement correct 301 redirects and update your sitemap, search engines will safely transition your rankings to the new URLs over time.

What is the best permalink structure for a news website?

For news websites that publish multiple articles daily, including the date in the URL (like the 'Day and name' structure) can be beneficial. It helps search engines and readers quickly identify the freshness of the news. For standard blogs and business websites, the 'Post name' structure is highly recommended.

Why am I getting a 404 error after changing my permalinks?

A 404 error usually means your web server's redirection rules did not update correctly. To fix this, go to Settings > Permalinks in your WordPress dashboard and click 'Save Changes' again. This forces WordPress to rewrite your .htaccess file. If the issue persists, check your file permissions or contact your hosting provider.

Post a Comment