I am using a multisite WordPress install to manage several blogs for our different shops, the current set up looks something like this:


When setting up WordPress I set the base url to /blogs/. The problem is a default site was also created at /blogs/ which we don't need and would like to remove.

Is there anything I can do to remove/disable this site. I just want to make sure the public can't access it. Throwing a 404 or a redirect to another page would be ideal.

2 Answers 2


The best solution is to set up a redirect in the web server. If for some reason this is not possible, you can install a plugin like Simple 301 Redirects to manage the redirections from the default blog.


A .htaccess redirect wouldn't really cut it as it would take a ton of rules to prevent access to the default sites various valid urls, I.E. :


while still allowing access to urls like:


I worked around this by creating a new function that I placed in the themes functions.php. This function gets the current blogs uri string by exploding the blogs path and returning the last segment.

function getBlogName() {

    global $current_blog; 
    $blog_path = explode('/',$current_blog->path); 

    if(isset($blog_path[2])) {
        return $blog_path[2];

In the case of the default blog, it has no name and thus no last segment so the above function returns false. I do a check to see if the above function returns false, and then redirect accordingly. This can be placed in the top of your themes header.php

if(!getBlogName()) {
    header("Location: http://www.mydomain.com/", true, 301);
  • You put this in every theme for each blog? or just the master blog? It will only fire for that blog. What you should do is create a simple (no interface) plugin and enable it network wide (that would hide it from sub-blogs). The benefit being if you change themes anywhere you don't need to go back and re-incorporate this code. In thinking about this however, you would only need it in your main themes plugins, since that is the only one you need to redirect. And since you're probably not going to be changing the theme for a blog you don't use, I suppose it doesn't really matter.
    – Madivad
    Dec 4, 2014 at 0:19
  • In my case all blogs use the same theme, so I put it in a single theme used by every blog.
    – Jeemusu
    Dec 4, 2014 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.