admin管理员组

文章数量:1410737

I am trying to have a permalink strucutre as follows:

/category [List all the posts for the category]
/category/child-category [List all the posts for the child category]
/category/post-slug

My permalink settings is as follows:

/%category%/%postname%/

The category base is blank.

But if I navigate to /category/child-category from the URL bar, the link 404s. It only works when I navigate to /child-category without the parent category from the URL bar.

What would I need to do to have the permalink structure that I am trying to accomplish?

I am trying to have a permalink strucutre as follows:

/category [List all the posts for the category]
/category/child-category [List all the posts for the child category]
/category/post-slug

My permalink settings is as follows:

/%category%/%postname%/

The category base is blank.

But if I navigate to /category/child-category from the URL bar, the link 404s. It only works when I navigate to /child-category without the parent category from the URL bar.

What would I need to do to have the permalink structure that I am trying to accomplish?

Share Improve this question edited May 18, 2017 at 8:04 Niraj Pandey asked May 17, 2017 at 14:39 Niraj PandeyNiraj Pandey 1551 silver badge7 bronze badges 2
  • What do you mean 'I go'? Do you type the URL in the address bar or you follow some navigation links? Please edit your question. Also, /category/child-category/post-slug/ is how it should work with your permalink structure. – Max Yudin Commented May 17, 2017 at 16:32
  • @MaxYudin I have clarified the question and removed the part about 'post' slug as I found out I could simply what I wanted by changing the Primary Category when selecting a category. – Niraj Pandey Commented May 18, 2017 at 8:06
Add a comment  | 

1 Answer 1

Reset to default 1

I figured out why this was not working. I had to set the category base to a dot(.) without any plugins but since I had 'Yoast SEO' Plugin instead, I had the not set the correct settings. To achieve the permalink structure I required:

Without Plugin:

  1. Go to Setting > Permalinks
  2. Select Custom Structure
  3. Add /%category%/%postname%/ after your domain
  4. Change Category Base to period/dot.

With Yoast SEO plugin:

  1. Go to Yoast SEO
  2. Select advanced
  3. Click on the tab permalinks at the top
  4. Check Strip the category base (usually /category/) from the category URL.

Here is where is got those steps from (and some other ways to remove category base)

本文标签: Custom Permalink with child categories creating 404