banner-img

Fixing WordPress Permalinks Not Working: Complete Troubleshooting Guide

If your WordPress site suddenly starts throwing 404 errors or loads posts with weird ?p=123 URLs, chances are your permalinks are broken. It’s frustrating, especially when the admin panel works fine, but the front end doesn’t. The good news? It’s usually a simple fix that doesn’t require advanced coding knowledge.

Permalink issues often happens after plugin updates, theme changes, or server-side adjustments. These issues are common and can happen with anyone. Even an experienced WordPress development agency can run into these problems. Just knowing where to look and what to reset can save you a lot of trial and error.

In this guide, we’ll walk you through both quick and advanced ways to fix broken permalinks in WordPress. From dashboard resets and .htaccess tweaks to database checks and WP-CLI commands, we’ve covered everything you need to get your URLs back on track.

Before diving into complex fixes, it’s worth trying the simplest solution first. In most cases, permalink issues happen because WordPress’s internal rewrite rules aren’t up to date. Luckily, there’s a built-in way to refresh them, and it only takes a few clicks. Here’s how to reset permalink settings in the dashboard:

  1. Log in to your WordPress admin dashboard.
  2. Navigate to Settings > Permalinks.
  3. Without changing anything, click the Save Changes button.

That’s it! No need to select a different structure or toggle any settings–just saving the current configuration triggers WordPress to rebuild the permalink rewrite rules behind the scenes.

Why This Works

When you save permalink settings, WordPress flushes and regenerates the .htaccess rules or rewrites the array stored in the database. This resolves broken URL mapping without touching any code or server files.

Example:
If your post URL was showing a 404 like https://yoursite.com/sample-post/ and after saving permalinks, it should begin working again.

If this doesn’t resolve the issue, don’t worry–there are more targeted fixes ahead. But for many users, this quick reset does the trick and gets everything back to normal.

If saving permalinks didn’t solve the issue, the next step is to check the actual files and configuration WordPress depends on, especially if you’re using an Apache server. A missing or misconfigured .htaccess file is often the silent culprit behind broken permalinks.

Fix or Regenerate .htaccess (for Apache Users)

The .htaccess file in WordPress is critical for handling clean URLs. WordPress uses it to manage rewrite rules when running on Apache.

Default WordPress .htaccess Example:

Make sure your .htaccess file (located in your site’s root directory) contains 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

File Permissions

Ensure .htaccess has the correct permissions:

chmod 644 .htaccess

If the file doesn’t exist, you can create it manually using a code/text editor and upload it to your site’s root folder.

Enable mod_rewrite Module

Apache uses mod_rewrite to handle the pretty permalink structures. If it’s disabled, permalinks will not work properly.

Enable mod_rewrite via Terminal (Ubuntu/Debian):

sudo a2enmod rewrite

sudo systemctl restart apache2

Also, make sure your Apache site config allows .htaccess overrides:

<Directory /var/www/html>

    AllowOverride All

</Directory>

You may need to update your Apache config file (/etc/apache2/apache2.conf) and then reload Apache. These file-level adjustments often solve the issue for Apache-based servers. Once done, revisit your permalink settings and click Save Changes again–just to be sure everything syncs properly.

If file-level tweaks didn’t do the trick, your server configuration might be the cause. Web servers like Apache and NGINX need specific settings to support WordPress permalinks. Without the right rewrite rules, clean URLs simply won’t work, even if WordPress is configured correctly.

NGINX Rewrite Rules

NGINX doesn’t use .htaccess files, so rewrite rules must be defined in your site’s server block configuration.

Recommended NGINX Location Block:

Add this inside your site’s config file (commonly found at /etc/nginx/sites-available/your-site):

location / {

    try_files $uri $uri/ /index.php?$args;

}
  • This line tells NGINX to try the actual file or directory first and, if not found, pass the request to index.php, which is how WordPress routes URLs internally.
  • After making changes, restart NGINX:
sudo systemctl restart nginx

Restart or Reload Your Web Server

Any changes to server config files won’t take effect until you reload or restart the web server.

Apache:

sudo systemctl restart apache2

NGINX:

sudo systemctl restart nginx

For local setups like XAMPP or MAMP, use the built-in control panel to restart Apache or NGINX. Once server configurations are updated and the service is restarted, your WordPress permalinks should begin functioning normally, assuming all rewrite logic is in place. This step bridges the gap between what WordPress expects and what your server actually delivers.

Checking for Plugin and Theme Interference Conflicts

Sometimes, the issue isn’t with WordPress or your server–it’s a conflict caused by a plugin or theme. Certain plugins (especially SEO, redirect, or security tools) and even custom themes can interfere with permalink behavior.

Detecting Plugin Conflicts

To find out if a plugin is causing the problem, follow this step-by-step method:

  1. Deactivate all plugins from the WordPress dashboard:
    Go to Plugins > Installed Plugins, select all, choose Deactivate, and apply.
  1. Test permalinks after deactivating:
    Try visiting one of your post URLs. If it works, you know a plugin is to blame.
  2. Reactivate plugins one-by-one:
    Enable each plugin individually and check permalinks after each activation. This helps pinpoint the exact plugin causing the conflict.

Tip: Look out for caching plugins, redirect tools, or security plugins–these are common culprits.

Switch to a Default Theme

Sometimes, a poorly-coded theme (or one with custom rewrite behavior) may interfere with permalinks. Here’s how to check it:

  1. Go to Appearance > Themes.
  2. Activate a default WordPress theme like Twenty Twenty-Four.
  3. Test your site’s URLs again.

If permalinks work with the default theme, your original theme likely needs debugging or updates.

Identifying conflicts doesn’t require any technical coding–just a systematic process of elimination. Once the faulty plugin or theme is found, you can either look for alternatives, contact the developer, or update to a fixed version.

If you’ve tried all the basic and intermediate steps but permalinks are still broken, it’s time to dig deeper. These fixes are for developers or advanced users comfortable working with WordPress internals, code, and server-level tools.

Manually Flush Rewrite Rules in Code

In rare cases, WordPress doesn’t auto-flush its rewrite rules, especially when dealing with custom post types or taxonomy rewrites. You can trigger this manually in your theme or plugin code.

Add This Temporarily in functions.php:

add_action('init', function() {

    flush_rewrite_rules();

});
  • Visit the front end once, then remove the code to avoid unnecessary flushing on every page load.
  • Alternatively, use this once inside a plugin activation hook.

Custom Post Type Rewrite Settings

If you’re using a custom post type and getting 404 errors, double-check its registration settings.

Correct Way to Register a Custom Post Type:

register_post_type('portfolio', [

    'labels' => [...],

    'public' => true,

    'rewrite' => ['slug' => 'portfolio'],

    'has_archive' => true,

]);

After updating, go to Settings > Permalinks and click Save Changes to flush the rewrite rules.

Check .htaccess Rewrite Conditions

Developers sometimes add advanced rewrite conditions or custom directives. These might unintentionally block WordPress URLs. Double-check that no rewrite rule before the default block is intercepting or rewriting requests prematurely.

Advanced fixes give you full control when default behaviors fall short. They’re especially useful when building custom functionality or working in complex hosting environments. Just remember to back up your site before making code or config changes.

Sometimes, permalink problems are rooted in the WordPress database itself. Corrupted options, wrong site URLs, or missing values can quietly break URL structures. These issues aren’t always visible on the surface but can affect how WordPress generates links.

Check siteurl and home Values

Your site’s base URLs must be correctly set in the database, especially after a domain change or site migration.

Verify with SQL (via phpMyAdmin or WP-CLI):

SELECT option_name, option_value 

FROM wp_options 

WHERE option_name IN ('siteurl', 'home');

Both values should match your actual domain, like:

https://example.com

If values are incorrect, update them directly in phpMyAdmin or using WP-CLI:

wp option update siteurl "https://example.com"
wp option update home "https://example.com"

If the permalink setting itself is corrupted, you can reset it in the database.

Set permalinks back to “Plain”:

wp option update permalink_structure ""

Then, go back to the dashboard and re-save your desired structure (like /post-name/).

Use WP-CLI to Flush Rewrite Rules

This is handy when working remotely or without admin access.

wp rewrite flush

It works just like hitting “Save Changes” in the dashboard, but through the command line. Database-level checks are often overlooked, but they can be the hidden fix when everything else seems in place. Once your site URLs and permalink settings are properly aligned, your link structure should start behaving as expected.

Even after fixing permalinks, you might still see broken or outdated URLs. That’s often due to cached versions of your site being served by caching plugins or CDNs (Content Delivery Networks). While caching boosts speed, it can sometimes delay the reflection of permalink changes.

Clear WordPress Cache

If you’re using a caching plugin (like WP Super Cache, W3 Total Cache, or LiteSpeed Cache), purge all cached files. How to clear cache (example using W3 Total Cache):

  • Go to Performance > Dashboard
  • Click Empty All Caches

Other plugins have similar options under their settings menus.

Purge CDN Cache (Cloudflare, etc.)

If your site uses a CDN like Cloudflare, it may continue serving outdated URLs until its cache is cleared. Here’s how to clear the cache in Cloudflare:

  1. Log in to your Cloudflare dashboard.
  2. Select your site.
  3. Go to Caching > Configuration.
  4. Click Purge Everything.

Be cautious: This clears the entire cached site globally. Use only when needed.

Disable Object or Opcode Caching Temporarily

If you’re using advanced caching layers (e.g., Redis, Memcached, or OPCache), these might also store rewrite rules or page paths.

You can disable them temporarily via your hosting control panel or php.ini settings to test if they’re affecting permalink resolution.

Caching and CDN layers are great for performance, but they can mask changes like permalink updates. Once cleared, your changes should reflect instantly, and any lingering 404s or routing issues should disappear.

When something’s off with your WordPress permalinks, your site usually gives you signs. These signs are often easy to spot, and recognizing them early can save hours of debugging. Here are the most common symptoms you might come across:

404 Errors on Posts or Pages

You visit a published post or page and get a 404 Not Found message. The content still exists in your dashboard, but visitors can’t reach it.

Example:
Trying to access https://yoursite.com/sample-post/. Results in a 404 Page Not Found error. This usually indicates a rewrite rule issue or a missing .htaccess file.

URLs Revert to Default ?p=123 Format

Instead of clean URLs like /about-us, WordPress falls back to its plain URL format: https://yoursite.com/?p=123. This suggests permalinks are either not saved properly or server rewrite settings aren’t working.

Custom Post Type URLs Not Working

Pages or posts from custom post types (like portfolios, events, etc.) return 404 errors or blank pages.

Example:
Trying to access https://yoursite.com/portfolio/design-project, and it leads to a 404 or no content page. This could be due to missing rewrite rules in your custom post-type registration or a need to flush rewrite rules.

Admin Works, Front-End Doesn’t

You can edit and access posts inside the WordPress admin dashboard, but front-end visitors get broken URLs or blank pages. This typically means the database and content are intact, but the rewrite engine isn’t mapping URLs correctly.

When you notice any of these symptoms, it’s a clear sign that permalink-related configurations aren’t working as they should. In the next sections, we’ll walk you through all the ways to fix them, starting with the quickest solutions first.

Hidden Fixes & Final Diagnostic Flow for Advanced Troubleshooting

When permalink problems persist despite all common fixes, it’s time to adopt a systematic debugging approach. This section provides hidden techniques and a step-by-step diagnostic flow to pinpoint and solve stubborn permalink issues efficiently.

Enable WordPress Debug Mode

Start by turning on debugging for your WordPress site to catch errors or warnings that might hint at the root cause. Add these lines to your wp-config.php file just before the line that says /* That’s all, stop editing! */:

define('WP_DEBUG', true);

define('WP_DEBUG_LOG', true);

define('WP_DEBUG_DISPLAY', false);
  • This logs errors to /wp-content/debug.log without showing them to visitors.
  • Check the log after reproducing the permalink issues to identify hidden PHP errors or conflicts.

Check Server Error Logs

Besides WordPress, your web server logs (Apache or NGINX) can reveal rewrite or permission errors affecting permalinks.

  • On Linux servers, typical log locations are:
    • Apache: /var/log/apache2/error.log
    • NGINX: /var/log/nginx/error.log
  • Look for errors related to .htaccess, mod_rewrite, or permission-denied messages.

Use this checklist to systematically identify and fix permalink issues in a single session:

  1. Reset permalinks via Settings > Permalinks > Save Changes.
  2. Check that the .htaccess file exists and has the correct contents and permissions (for Apache).
  3. Verify that mod_rewrite is enabled on your server.
  4. Confirm correct rewrite rules on NGINX or other server types.
  5. Deactivate all plugins to rule out conflicts.
  6. Switch to a default theme to isolate theme-related issues.
  7. Clear all caches and CDN caches.
  8. Verify siteurl and home database values match your domain.
  9. Flush rewrite rules manually via code or WP-CLI (wp rewrite flush).
  10. Check debug logs and server error logs for hidden errors.

Following this flow saves time and ensures you don’t miss subtle causes. If you reach the end without success, consider consulting your hosting provider or a WordPress developer for deeper analysis.

By combining systematic debugging with this all-in-one checklist, you can confidently resolve even the most stubborn permalink problems without guesswork.

How to enable Permalinks in WordPress?

To enable Permalinks in WordPress, go to your WordPress dashboard → Settings → Permalinks. Choose any structure other than “Plain” (like “Post name”) and click Save Changes. This automatically enables pretty permalinks for your site.

Why is my 404 page not working on WordPress?

If your 404 page isn’t showing properly, it’s likely a permalink or theme issue. Start by resetting permalinks under Settings → Permalinks. If that doesn’t help, switch to a default theme or check for plugin conflicts.

How do I fix a broken link in WordPress?

To fix a broken link in WordPress, use a plugin like Broken Link Checker to find broken URLs. Then, manually update them in your posts, pages, or menus. For missing content, you can also set up 301 redirects using a plugin like Redirection.

How do I reset WordPress Permalinks?

To reset WordPress permalinks, go to Settings → Permalinks in your dashboard. Without changing anything, just click Save Changes. This forces WordPress to regenerate the .htaccess rewrite rules.

How do I refresh WordPress Permalinks?

To refresh WordPress permalinks, you can refresh permalinks by re-saving the settings:
Go to Settings → Permalinks and click Save Changes.
For a deeper reset, you can also use WP-CLI with the flush rewrite rules command.

Let’s Summarize

Fixing permalink issues in WordPress can feel overwhelming, but most problems boil down to simple misconfigurations. Whether it’s a missing .htaccess file, caching conflicts, or server-level settings, there’s always a way to bring your site back to normal.

The key is knowing where to look. Start with basic dashboard resets, then move to server tweaks and code-based solutions if needed. And don’t forget to flush your caches after making changes; it’s a small step that solves big problems.

If you’re stuck or just want expert help, you can count on us. Our team specializes in fixing technical issues, optimizing performance, and building custom solutions. Contact us today and let professional developers take the hassle out of troubleshooting so you can focus on growing your site.

Bijal Shah
Bijal Shah

Bijal Shah is a skilled WordPress expert and technical content writer with a passion for making complex topics easy to understand. With her expertise in web development and CMS platforms, Bijal specializes in creating clear, informative, and practical content that helps businesses navigate the digital world.

Leave a Comment

30 days Money Back Guarantee
Secure Online Payment
1 Year of Updates & Support