WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Why is blogs.dir/1/files/ visible in file URLs? (54 posts)

  1. RavanH
    Member
    Posted 3 years ago #

    Hi,

    On the main site of a multi-site install, all image and other uploaded file URLs show .../blogs.dir/1/files/... instead of just .../files/... like on all the other sites in the network.

    Why is that? I had not noticed it before. Is this since the upgrade to 3.1?

    Checking options like Fileupload Url it says .../files/ just like it should but still files in the Media Library are presented with the /blogs.dir/1/ in the path. All files are accessible via the URL without blogs.dir just fine, so there is no need for this happening.

    Is there anything I can do about it?

  2. but still files in the Media Library are presented with the /blogs.dir/1/

    The media library only or the front end of the site?

  3. RavanH
    Member
    Posted 3 years ago #

    Yes, also when inserting images into posts: the /blogs.dir/1/ is visible in both the src="" and in the link URL.

    So this is not normal behaviour or a known bug?

  4. Um. It's supposed to point to /files/ (not blogs.dir) on the front end of everything. The image source etc.

    Check the per site settings again. There are, I think, three places where it refs image locations.

  5. RavanH
    Member
    Posted 3 years ago #

    Ipstenu, thanks for your support on this!

    The main site settings contain the following URL related options:

    Siteurl: http://mydomain.tld/
    Home: http://mydomain.tld/
    Upload Path: wp-content/blogs.dir/1/files
    Upload Url Path: (empty)
    Fileupload Url: http://mydomain.tld/files

    A sub-site (working correctly, with ID 2 in this example) has:

    Siteurl: http://sub.mydomain.tld/
    Home: http://sub.mydomain.tld/
    Upload Path: wp-content/blogs.dir/2/files
    Upload Url Path: (empty)
    Fileupload Url: http://sub.mydomain.tld/files

    This looks all correct to me and I did not find any other options that might be related :(

    ==========
    HYPOTHESIS
    ==========

    It occurred to me that I installed WP this in Multi-site mode from the start instead of installing it as a regular version and then upgrading to multi-site.

    On another installation where I followed the latter procedure, the main site was using /content/uploads/ and continues to use wp-content/uploads/ after the upgrade (and still visible on the front-end too) while all sub-sites use blogs.dir/x/files/ (visible as /files/ on the front end). I guess this is supposed to happen so if everybody installs as regular and then upgrades to multi-site, this behaviour will not be seen as a problem...

    ... But when installing as multi-site from the get-go, this suddenly reveals the blogs.dir on the main site.

    Could that be going on?

  6. So, fill me in. *How* did you install multisite from the get-go? I mean what steps?

    I've added the the first define when install WP, so the Network setup menu shows up first thing, and it worked fine.

  7. RavanH
    Member
    Posted 3 years ago #

    Hi Andrea, yes I remember doing the same. As opposed to the second install I spoke of, which was installed in regular mode and upgraded to multi-site in a later stage. Therem, the main site is using /wp-content/uploads/ ... Apart from that, I see no differences between the two installations.

    ( That second install is also running Multi Networks for WordPress and if I clone the main site to become a new network, the main site on that network will use /blogs.dir/x/files/ just like the main site on my first install. Which leads me to conclude that there is no real difference between the two. )

    So even when adding the allow multi-site define during install, I should be seeing /files/ on the main site too?

    I really wonder what went wrong then. And if the sites options are correct, is there anything else (like something in the wp_blogs table) I can edit in the DB to change this?

  8. Lemme consult with the brains part of this operation.

  9. AHA!

    Expected behaviour.

    basically, during setup it;s checking to see if it's multisite, and even tho we're setting up the first and only blog, WP sees the multisite define in there and goes "oh yeah, multisite, use blogs.dir..." and continues.

    So. Expected behaviour. (I guess. makes snese tho.)

  10. RavanH
    Member
    Posted 3 years ago #

    Thanks Adrea for checking this out :)

    But... After going "oh yeah, multisite, use blogs.dir..," why would WP not continue with: "... and do that neat blogs.dir hiding trick on the front end..."?

    Would that not be expected behaviour as well? Since it's doing that for all sub sites, why not the main site?

  11. Okay, I get why it's doing that.

    So, you tricked WP firs toff my putting that line in there at the first, so it set the uploads folders as if it were an upgraded MU install.

    But then, continuing with setting up the network trips WP into going, "Okay, don't do the rewrite thingy on the main blog".

  12. RavanH
    Member
    Posted 3 years ago #

    Hmmm... right, so I should not have done that installation as multi-site from the start then. I'll have to live with the consequences I suppose ;)

    But this behaviour poses another problem as well:

    I'm using ddean's excellent plugin Networks for WordPress to create a second network on an install that uses wp-content/uploads/ on its main site (like it is supposed to do) ... The problem is that this new network's main site uses /blogs.dir/files/ !

    I've added the tag networks-for-wordpress to this thread in the hopes that we can find some way around this problem either by making WP use the /files/ trick on the main site or by making the Multi Networks plugin fix it for the main sites of sub-networks...

    Hope I explained that clear enough ;)

  13. I'm using ddean's excellent plugin Networks for WordPress to create a second network on an install that uses wp-content/uploads/ on its main site (like it is supposed to do) ... The problem is that this new network's main site uses /blogs.dir/files/ !

    A new network is not going to use the same uploads folder on the main blog period.

    In the db, it's just another blog ID. Not a "main" one. It'll use the blogs.dir folder.

    (we have a networks plguin too ;) )

  14. RavanH
    Member
    Posted 3 years ago #

    Andrea, what networks plugin are you using? And does it not suffer from this issue?

    A new network is not going to use the same uploads folder on the main blog period.

    Obviously... but I am looking for a way to make WP use the /files/ URL on the other networks main sites. And in the case of my install where the main site uses blogs.dir/1/files/ too...

    To make it less confusing, let me divide this in into 2 questions:

    1. Is there a way to make WP use the /files/ URL instead of /blogs.id/1/files/ on the main site of my first install (where I installed with multi-site enabled from the start)?

    2. And if there is not, is there at least a way to make the plugin Networks for WordPress force the use of /files/ URL instead of /blogs.id/x/files/ on each of the other networks main sites?

    I am supposing here that if #1 is possible, #2 is no longer needed. But if #1 is not possible, #2 would be better than nothing at all...

  15. 1. reinstall.

    2. no, this is *not possible*. Doesn't matter what networks plugin you use, it's got nothing to do with it.

    in the database, the main site of the second network is just an incremented blog id. could be 29 or 4827356824. It's not blog ID 1 on site id 2. So no, what you want (wp-content/uploads on main site in second and subsequent networks) just is not possible.

    It is only for blog ID 1. that is it.

  16. Oh hey, lemme reread that. :D

    is there at least a way to make the plugin Networks for WordPress force the use of /files/ URL instead of /blogs.id/x/files/ on each of the other networks main sites?

    I think you've mucked something up here.

    See this?

    http://atypicalife.net/blog/2011/03/01/worlds-biggest-igloo/5x8o/

    It's a rewritten url for an image, right?

    It's on a second network.

    If I were you I'd redo the entrie install. Or try this plugin:
    http://wordpress.org/extend/plugins/wp-multi-network/

    I don't think our (right here, yes it's paid) would fix the issue at all.

  17. RavanH
    Member
    Posted 3 years ago #

    So no, what you want (wp-content/uploads on main site in second and subsequent networks) just is not possible.

    That's NOT what I want. Obviously, that's not possible and I'm quite happy with the main site(s) using /wp-content/bogs.dir/x/files/ but what I want is for them to visibly use /files/ on the front end like all other sites. But you probably understood that after the reread?

    1. reinstall.

    Reinstalling would make the main site use /wp-content/uploads/, or not? I already achieved the same result by just editing the main sites options Upload Path and Fileupload Url and manually copying the files from /blogs.dir/1/files/ to /uploads/ ... I'll have to go through every post to edit the URLs but that will be a lot less work than reinstalling the complete network.

    So the question remains, what about those main sites of secondary networks? It seems Fileupload Url is ignored there...

    See this?

    http://atypicalife.net/blog/2011/03/01/worlds-biggest-igloo/5x8o/

    It's a rewritten url for an image, right?

    It's on a second network.

    Ok, but is it on the second networks MAIN site? If so, then where did I muck up? David Dean, any thoughts on this?

    Oh, I can do the same by removing the /wp-content/blogs.id/x from the image url manually (leaving the /files/ in there) on any main site and it would work just fine, but since I'm not the one that's going to be taking care of the content of those other main sites, I'd like to have WP use /files/ by default.

    Or try this plugin:
    http://wordpress.org/extend/plugins/wp-multi-network/

    As far as I can tell, that's basically the same plugin. Or at least a similar (semantic) conversion of Multi-Site Manager the predecessor of Networks for WordPress... So I would be highly surprised if that would change anything.

    Maybe I do need your paid plugin then...

  18. Reinstalling would make the main site use /wp-content/uploads/, or not? I already achieved the same result by just editing the main sites options Upload Path and Fileupload Url and manually copying the files from /blogs.dir/1/files/ to /uploads/ ... I'll have to go through every post to edit the URLs but that will be a lot less work than reinstalling the complete network.

    Yes, it would, but I see you fixed it manually anyway.

    Ok, but is it on the second networks MAIN site? If so, then where did I muck up?

    Yeah, it is. Not sure where ya mucked it up tho.

  19. David Dean
    Member
    Posted 3 years ago #

    Wow - Busy weekend!

    Did the fileupload_url for sites on the secondary network include blogs.dir? I thought that was what dictated the visible URLs and it should just be siteurl + files.

    If not, maybe there's an upload plugin that's using the wrong blog/site option to set a guid? I'm not really sure what else could be changing this.

    We've got about a dozen secondary networks and uploaded files use the correct path in each of their blogs.

  20. So we can rule out the plugin(s). :)

    I really think something got mucked up during install.

  21. RavanH
    Member
    Posted 3 years ago #

    Did the fileupload_url for sites on the secondary network include blogs.dir?

    No, it sais siteurl + /files/ there... All other options across the networks look correct too.

    I really wonder what could have gone wrong... On the install where this is occurring on secondary networks, I did nothing out of the ordinary during setup. The only thing I can think of: I am running Networks for WordPress from the normal /plugins/ folder and have it Network Activated across all networks. Would it make a difference if I move it (back) to /mu-plugins/ ?

  22. Tim Moore
    Moderator
    Posted 3 years ago #

    RavanH: You'd have to talk to the folks who wrote the Networks for WordPress plugin. If they wrote it specifically to be used at mu-plugins, they may not have udpated it to work as a network activated plugin (I've heard that some plugins don't work correctly network activated, but have not experienced that myself).

    The best thing to do at this point would be to back everything up and start from a fresh install. See if you run into the same problems. It would be best to do it on the same server, as then you could identify whether there is a server-side issue or a WordPress issue.

  23. . On the install where this is occurring on secondary networks, I did nothing out of the ordinary during setup.

    other than adding the multisite line before you installed wordpress/ Remember that? :D or is this a different install than the one in the first post in this thread?

    If it's the same one, then THAT is the issue I'm saying is mucking it up.

  24. RavanH
    Member
    Posted 3 years ago #

    other than adding the multisite line before you installed wordpress/ Remember that? :D or is this a different install than the one in the first post in this thread?

    I realize this is confusing and it would take too much to re-read the whole thread so: No, this is on the second install where I did it by first installing as regular and later upgrading to multisite. This is the only install that is running multiple networks. The main site of the main network uses /wp-content/uploads/ like it is supposed to, but each main site on secondary networks use this blogs.dir... sub-sites in both main network and secondary networks are fine.

  25. David Dean
    Member
    Posted 3 years ago #

    The only thing that changes if you put the Networks plugin in mu-plugins is that you'll get the admin menu in each network. You can disable or remove it entirely after creating your secondary networks, and they will function just fine.

    Back to the problem at hand: every site after the first will use blogs.dir/$blog_id/files for the upload_path and siteurl + files for the fileupload_url, unless you change them after they are created. It's the same whether they are created on the "main" network, or on a secondary network.

    Are there any other plugins or processes in play here? If the fileupload_url is correct, then check out the guid of the files.

    Background info:

    When you create a secondary network, the main site on the new network is made with wpmu_create_blog(), just like it would be if you added it to the main network. This in turn calls install_blog(), where you can see the options being set.

  26. but each main site on secondary networks use this blogs.dir...

    which I explained they are supposed to. but you said they are showing the full path and not being re-written, correct?

  27. RavanH
    Member
    Posted 3 years ago #

    which I explained they are supposed to. but you said they are showing the full path and not being re-written, correct?

    Yes, that's correct. I meant 'show' instead of 'use' there. Sorry for the confusion.

  28. RavanH
    Member
    Posted 3 years ago #

    David, yes, the guid for attachments shows /wp-content/blogs.dir/x/files/ on each of the main sites so that's also in the URL when inserting images in posts.

  29. Rewinding so I'm sure I get this...

    Upload Path = wp-content/blogs.dir/#/files
    Fileupload Url = http://domain.com/subblog/files
    Upload Url Path = <empty>

    Is that right?

    You MAY NOT have Upload Url Path by the way.

  30. RavanH
    Member
    Posted 3 years ago #

    Hi all,

    Sorry about not reacting to questions, I've been away for a while... This issue however has stayed :(

    Ipstenu, your rewind is correct. Except that I'm running subdomain instead of subdir installs but that does not seem relevant here.

    For the life of me, I cannot figure this out.

    David, apparently, for some reason during or after creation of a new network, the new main site will be showing full file paths even though Fileupload Url is set to http://domain.com/files
    Is there any switch in the Advanced options during network creation that might influence this? Could, in theory, any other plugin be causing this?

Topic Closed

This topic has been closed to new replies.

About this Topic