Skip links
How to create the best permalink structure in WordPress

The best permalink structure in WordPress (Case study)

Introduction: In the world of website optimization, choosing the best permalink structure is crucial for enhancing search engine visibility, user experience, and overall website performance. Permalink settings determine the structure and format of the URLs that represent each page on a website. By selecting the most appropriate permalink structure, businesses can create clear, concise, and SEO-friendly URLs easily understood by search engines and website visitors.

In this case study, we will explore the importance of selecting the best permalink structure and its impact on website performance. We will examine real-world examples from various industries and explore the considerations and best practices to consider when configuring permalink structures. Analyzing successful implementations and lessons learned, we aim to provide valuable insights and practical guidance for businesses looking to optimize their permalink structure.

Join us as we navigate the world of permalink structure and uncover the key factors to consider when determining the best URL structure. By the end of this case study, you will have a deeper understanding of how the best permalink structure can positively influence search engine rankings, user engagement, and the overall success of your website.

Job Description: The task involves altering the current URL structure of the website from “” to ““. However, several challenges and issues must be addressed during this process.


  1. Redirection of Existing Posts: There are 3,577 posts on the website that need to be redirected to the new URL pattern.
  2. Redirection Plugins: The client has two plugins for handling redirects: Rank Math and 301 redirects.
  3. Existing Redirects: There are already 304 redirects set up using the 301 redirects plugin.
  4. Stuck Import Button: The submit button in the Import section of Rank Math SEO Pro needs to be fixed for unknown reasons.
  5. Unnecessary URLs: Out of the total URLs, 844 do not require Redirection.


  1. Correct Redirection: Ensuring all links are redirected without negatively impacting website traffic and SEO.
  2. Plugin Selection: Choosing the most suitable plugin and method for handling the redirection process.
  3. Removing Duplicates: Identifying and eliminating duplicate and unnecessary redirects.

How to have the best permalink structure:

1- Exporting URLs and Format Conversion

    • Initially, we exported all the URLs from the website’s sitemap in XML format.
    • We Converted the XML file to a CSV format to facilitate easier processing.
    • This conversion resulted in a CSV file containing 3,577 old URLs that required further handling and Redirection.

2- Sorting URLs and Identifying Redirection

    • Using Excel, we segregated the URLs into two groups: those already in the new URL pattern and those requiring Redirection.
    • A simple sorting process enabled us to identify that out of the 3,577 URLs, 844 were already in the new pattern, while 2,744 URLs required Redirection.

3- Generating New URLs

    • We developed a Python code snippet to efficiently handle the URL redirection process that generated new URLs based on the desired pattern.
  • python code for seperating urls and create best permalink settings
    • This automation allowed us to quickly generate the new pattern for the 2,744 URLs that needed Redirection.

4- Exporting and Consolidating Redirects

    • We exported the existing 304 redirects from the 301 Redirect plugin and removed them from the system.
    • By consolidating the redirects within the Rank Math plugin, we streamlined the redirection process and reduced the number of plugins involved.

Export redires rules in 301 redirect plugin

5- Detecting Duplicate Redirects

    • We compared two sets of redirect files to identify duplicate URLs—one with 304 redirects and the other with 3,577 URLs.
    • Fortunately, no duplicate URLs were found, ensuring a clean redirection process without redundancy.

How to Set Up Redirects in WordPress

6- Merging Files and Importing Redirects

    • To proceed with the redirection implementation, we merged both sets of files into a single CSV file.
    • However, we encountered an issue where the import section of Rank Math got stuck unexpectedly.
    • To resolve this, we requested credentials from the client for the Rank Math plugin, submitted a ticket to the Rank Math support team, and sought their assistance.
    • Collaborating with the Rank Math team ensures a comprehensive and safe solution while preserving user data.

7- Verifying Cron Job Functionality

    • Since Rank Math operates with a Cron job, we installed WP Control to verify the proper functioning of the related Cron job.
    • This step ensured the redirection process would be executed according to the desired schedule.

8- Splitting Files for Improved Handling

    • We split one CSV file into five separate files to prevent excessive server load and assist the Rank Math plugin handle the redirection process more effectively.
    • This division helped optimize the overall performance of the website servers during the redirection implementation.

9- Updating Permalink Settings

    • After completing the redirection process, we adjusted the Permalink settings to the desired URL pattern (best permalink structure), ensuring consistency throughout the website.

Create a custom permalink Structure in WordPress.

Best permalink structure in wordpress settings
correction: /news/%postname%/

You can see the redirections hits in the first hour and the 72 hours! We had almost 600 redirection hits in the first 3 days, which means they are working, and we didn’t lose any traffic.

Leave a comment

🍪   We use cookies to provide the best web experience possible