# 404 template part not loading when custom permalink structure is set

**URL:** https://discourse.roots.io/t/404-template-part-not-loading-when-custom-permalink-structure-is-set/26819
**Category:** sage
**Tags:** sage9
**Created:** 2024-03-06T15:40:11Z
**Posts:** 5

## Post 1 by @webgurus — 2024-03-06T15:40:11Z

I’ve set a custom permalink structure to have /blog/ included in the permalinks for posts. This is the custom permalink declaration in the WordPress settings page: /blog/%postname%/

The issue I’m facing is that the 404 page template is not loading if the custom permalink structure is active. Everything works fine if using the /%postname%/ permalink structure or not using permalinks at all.

 ![Screenshot 2024-03-06 at 17.53.10](https://discourse.roots.io/uploads/default/original/2X/3/3152c9160d07604d8733b37d3a7f0d00b7f87c1b.jpeg)

Any thoughts?  
Thanks,  
Marto

---

## Post 2 by @folbert — 2024-03-06T19:48:06Z

Have you tested with another theme to find out if Sage is the culprit or not?

Regardless, I suggest you install [Debug Bar – WordPress plugin | WordPress.org](https://wordpress.org/plugins/debug-bar/) or something similar that lets you see the request and which rewrite rule is being matched by your URL. That should help you tracking down any underlying issue.

Possibly also add [https://wordpress.org/plugins/debug-bar-rewrite-rules/](https://wordpress.org/plugins/debug-bar-rewrite-rules/) to further ease debugging rewrite rules if needed.

---

## Post 3 by @webgurus — 2024-03-07T09:16:47Z

Hello folbert,  
I have tested with twentytwenty theme and in that case it works.

---

## Post 4 by @webgurus — 2024-03-12T15:41:46Z

Any idea here? this is actually happening on any Sage9 theme that I’ve tried when I try to use a custom permalink structure for posts.

Here’s the debug info from the Debug Bar.

 ![Screenshot 2024-03-12 at 17.40.44](https://discourse.roots.io/uploads/default/original/2X/2/2e1881c4ed5bced5b908efb536dbae46c936cb03.png)  
 ![Screenshot 2024-03-12 at 17.40.53](https://discourse.roots.io/uploads/default/original/2X/8/844ae83c142fee3c455b195948e024130e058c91.png)

---

## Post 5 by @folbert — 2024-03-12T21:20:27Z

Sorry, I misread your first post and thought you got 404 on a valid blog-url. The plugins I suggested ant that you screenshotted probably doesnt help at all.

FWIW, I have Sage9-sites with custom permalink structure, including ”blog” where the 404-template loads without any issues.

I dont have any other suggestion than to do some code diving to, for example, see if WP is loading another template or maybe change the content of your 404-tpl to just a harcoded text to make sure it is not loaded.
