Remove blog slug from multisite installations

multisite

WordPress has this wonderful feature that allows you to create an endless number of websites from a single installation of the software. It’s known as multisite, or a network installation, and setting it up is relatively easy.

This network will always be based on the very first website you create, each subsequent site becoming an offshoot. By default, once converted into a network, WordPress adds the slug “/blog” to all posts within the site. So if previously a post on your site resided at www.mysite.com/post-about-cool-stuff, the new URL would become www.mysite.com/blog/post-about-cool-stuff.

Maybe that works for you.

Personally I’m in the habit of suppressing that slug, either because it’s extra baggage I don’t feel the site needs, or because there are already well-established URLs for which I don’t want to have to create redirects.

In the past I used plugins, but recently decided to look around to see if I could find anything new on the question. Low and behold I stumbled on this thread and this one on the forums that pointed me to a simple solution.

All it takes to remove the blog slug from your main site is to update the site’s permalink settings from the network dashboard, deleting /%blog%/ from the slug, and leaving only the variables that interest you.

I did find in one case that it was more than a one-step operation (possibly because I had deactivated my plugin and needed to flush the permalinks). My first go didn’t take so I:

  1. Changed the network permalink settings to something different for main site and saved.
  2. Returned to site’s permalink settings and reset to desired.
  3. Went back to network settings and deleted /%blog%/, leaving only the desired slugs.
  4. Worked!

This is not a new way to do things, just new information for ME since I initially looked into it many, many moons ago. This post will be my reminder for the next time I create a network set up, and hopefully will be useful to some of you out there too. Why use a plugin when you don’t have to?

Had a different experience? Got better explanations? Please share!

Jenny Beaumont

Jenny Beaumont is a multicultural, multidisciplinary maker and writer of things. She works as a Sr. Project Manager at Human Made, speaks at conferences in France and abroad, contributes to a number of blogs, and is a former organizer of WordCamp Paris and WordCamp Europe.

Follow me on Twitter | Subscribe to my newsletter

11 thoughts on “Remove blog slug from multisite installations

  1. This was driving me nuts having /blog/ in the URL as it is unnecessary. Thanks much for the instructions Jenny

  2. The technique worked fine, however I’d just like to mention I had an issue with wildcard redirects from the old wordpress site to the new one. Previously http://www.oldsite.com/post-name would redirect to http://www.newsite.com/post-name, with or without the www. Once the new site became part of a multi-site, and I removed the /blog slug, putting oldsite.com/post-name would redirect to the main page and not the specified post on the new site. So, if you are doing wildcard re-directs, you have to enforce that redirects are made only with www.

  3. I’m able to make it work if I select “Default” as the permalink settings for the site. But it doesn’t seem to work if I use “Post Name”. Has anyone had success with selecting “Post Name”? I really want the post name in the URL and not the post ID.

  4. Hi Jenny,

    I had installed WordPress in “blog” directory earlier but now removed that and installed on the main domain. My older slugs like: https://alltechtrix.com/blog/convert-pdf-files-to-word-online/ are now sending 404 errors.

    Do you have any idea to make redirect from https://alltechtrix.com/blog/* to https://alltechtrix.com/* so that the above URL may be automatically redirected to https://alltechtrix.com/convert-pdf-files-to-word-online/

    Did you notice the omission of /blog?

    Please help me fix it. Thanks!

Comments are closed.