How to prepend route with /blog for blog listing page only

My permalink settings is simply /%postname%/ (yes I read from the codex that this is bad performance practice). The result is:

  • a page url might look like site.com/pagename
  • a blog post looks like site.com/post-title
  • a portfolio (custom post type) post will look like site.com/portfolio/item-1

I would like my blog post page (single.php) to have a URL like site.com/blog/post-title. How might I do that?

Related posts

Leave a Reply

1 comment

  1. Change your permalink structure to /blog/%postname%/.

    EDIT

    To get your custom post type to leave out the /blog part, in its registration arguments array, set the rewrite argument like this:

    'rewrite' => array( 'slug' => 'portfolio', 'with_front' => false )