Moving existing site to MU. Can I move blogs.dir to custom subdir?

I'm not sure if what I am trying to do is the best solution or not. Let me describe what I'm trying to do.

I have an established (albeit crappy) wp site. Generally, my posts are laid out this way...

Now, I would like to convert my site to multi-site, using subdirectories, not subdomains. Of course, I will have a problem, since any new blogs will be on the same level as my existing posts. So what I was thinking was that it would be best to move the blogs.dir down one directory, for example: or something like that.

First of all, is this possible? Can I put blogs.dir down under a custom directory? Second, is this the best solution? I'm so excited about joining wpmudev (this is only my second post in the forum... I just signed up about 15 minutes ago!) and am eager to get started.

Any advice would be most appreciated. I'd really like to use a subdirectory structure for mu instead of subdomain, so that I can benefit SEO wise from any content. Thanks so much... I'm so excited to be a part of this group!!!

  • 3SixtyEvolve

    Hi @warpedmind

    Welcome to WPMU DEV and thank you for being a member of your Community :slight_smile: Glad to have you.

    Regarding the blogs.dir. First some basic information:

    Sub-directory sites work on the same principle as pretty permalinks do. The URL is rewritten to give the appearance that it is in a folder on the server. So, mod_rewrite has to be working on the server, and actually reading the .htaccess file. It’s the .htaccess file that does the heavy lifting of “making” the sub-directory site in this case.

    Images are physically located under the blogs.dir folder, in numbered folders from that correlating to each site’s blog-id#. These locations are then rewritten via the .htaccess file and served up to the 'new' location.

    Now you shouldn't really have to move the blogs.dir directory, since that folder is only for uploads to any of the blogs. The blogs themselves do not live there, they are virtual. When you make a new site this will just create a numbered folder in that folder.

    Like this: wp-content/blogs.dir/1/files

    Now it is possible to change the directory of blogs.dir, although you would need to do update your wp-config.php file to reflect the change as well, which is not really necessary or desirable.

    You would need to add something like this:

    update_option('upload_path', UPLOADBLOGSDIR . "/$blog_id/files");
    define( 'BLOGUPLOADDIR', 'media' );

    That should kick back /media/blog-id#/files/

    Hope this information is helpful and that you will assist you in getting your Multisite done.

    Have a good day!


  • warpedmind

    Thanks so much for the reply!

    I'm kinda dumb as a rock here, so please bear with me. Are you basically saying that when I reinstall wp and make it multisite, that I don't actually have to make any additional changes or customizations once I've restored my db?

    So what will happen when a user creates a new site under me? Let's say I have an article out on the web at and then the new user creates a new site. Will his new site also be on the same level? Will it be What happens if my postname=newuser?

    (By the way, the reason that I'm reinstalling wp and then restoring the db is because I saw on my Google results that apparently I've been the victim of sql injection. So I thought it'd be best to simply start over... I'm scared that that is the wrong decision, but I don't know what to do... so I figured it best to start over. What do you think? (Sorry for the tangent here))

    Thanks so much again for your informative reply!

  • 3SixtyEvolve


    First off, thank you so much for the rep points. We call it cookies amongst the Support Folk and I noticed that you emptied your cookie jar there, so I will have to work for them cookies :slight_smile:

    I have been in a similar position before, so I will most certainly bear with you, however, I have to tell you, your situation is a bit tricky. Rebuilding the database is fine, but if you want to re-import a database that has been a victim of sql injection it is possible and probable you will re-infect the new install.

    So, I would recommend that, unless you've identified the cause of the sql injection, it would be best to start with a fresh database and to not re-import the old one.

    I wish you all the best with your setup. Please keep me posted if you require any further assistance.

    Enjoy the rest of your day!


  • warpedmind

    Hi GinaB,

    Thanks for the reply... sorry, I've been distracted and haven't been around lately. No, I'm still in the same situation as before. I'm frustrated... I don't want to "start over" as my site already has articles, users, etc. I guess I'll have to look through the code, though I don't know what exactly I'm looking for. :slight_frown:

    Thanks again! If you can recommend a next step for me involving me keeping my data, I'd really appreciate it. Either way, I appreciate your input!

  • warpedmind

    You're awesome GinaB! Thanks so much!

    In the meantime, I've been trying to clean up my existing WP site. I've uninstalled all my plugins and reverted my site to one of the standard WP themes (20Eleven). It's now officially bare bones. I figured that every day that went by was another day closer to being delisted by Google. So I thought that ugly is better than nothing!

    I look forward to your research. It will help me ensure that whatever goes over to the new host will be clean, untainted, and secure. I wonder how long it will take for me to be able to confirm that I've successfully addressed the issue? I guess I'll have to wait a week or two and see if things look any different on Google.

    Thanks again GinaB, you rock! :slight_smile:

  • 3SixtyEvolve

    Hi @warpedmind

    I strive to rock, but don't know if I always do, but thank you for that vote of confidence! It's great to hear it. :slight_smile:

    So I did a bit of research - basically links that might help you to fix the sql injection and then be able to move your database successfully. This is what I came up with (I really hope this will help):

    I read through many pages and these were the best advice that I could find, so I hope this can assist you.

    Have a good day and let me know if you get sorted or if you need further support.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.