Olokoo
Olokoo

Reputation: 1144

Custom Permalink with Page Name Wordpress

I have looked all over the place and can't figure out how to get this to work.

I want my urls for blog posts to look like this: "www.website.com/my-page/category-name/blog-post-title"

The issue I am having is that I have a page called "my-page".

So I have a page "www.website.com/my-page/" which is just a standard wordpress page, but I want the url for the blog post to look like it is under that page.

Here is what I have for the permalink so far:

/my-page/%category%/%postname%/

But this doesn't work and gets a 404 error when opening a blog post.

At this point I don't believe it can be fixed through the wordpress gui, so if anyone has any recommendations, it would be appreciated.

Thanks!

Edit: I wanted to add that the permalink works fine if I remove "/my-page" or if I simply modify it so it does not match the page.

Upvotes: 0

Views: 1289

Answers (1)

Blackbam
Blackbam

Reputation: 19366

First of all you should not use the category in front of your permalinks as it leads to bad performance (and some posts may have multiple categories): http://ottopress.com/2010/category-in-permalinks-considered-harmful/

The second thing is - it should work. I tried with a fresh installation on WordPress and I get the correct results.

  • Did you flush rewrite rules / save the new permalink structure?
  • Did you publish a post?
  • Is your server correctly configured to use permalinks?

Third possibility - if your permalink structure does not work for some reason you can define a custom permalink structure:

https://codex.wordpress.org/Rewrite_API

Upvotes: 1

Related Questions