WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. in theory, yes a plugin could cause it.

    I have no ideas what's up either. At this point, you'd need someone to comb over the setup itself.

  2. Curtiss Grymala
    Member
    Posted 2 years ago #

    Can you create a new site within one of the networks in your MultiNetwork setup? Once you do that, try uploading media to the new site. See if it has the same issue.

    I just noticed on one of my multi-network setups that all of my "networks" (the root sites for each network), the media URLs seem to include the /blogs.dir/, but if I create a site in one of those networks and upload media to that inner site, the URL is the way it should be.

    I wonder if that might be the same issue you're seeing. If so, I'd guess it has something to do with WordPress not realizing that the new network should have its media URLs rewritten (since, in a normal multisite [not multi-network] environment, the first blog would not have rewritten URLs for its media, as those files would be placed in the uploads folder instead).

  3. @Curtis - which network plugin are you using? I can;t remember offhand if it's ours or not.

    On my second network, I can upload media to the main site and it has the /files/ address in there.

    example: http://atypicalife.net/files/2011/05/4711094896_0ac9156ced_b-crop.jpg

  4. Curtiss Grymala
    Member
    Posted 2 years ago #

    Andrea - I have yours installed right now. I'm thinking about resetting the installation to see if I can reproduce the issue or if the issue was caused by something in the original install.

  5. Yeah, at this point I'd love to find out where it's falling down.

  6. RavanH
    Member
    Posted 2 years ago #

    I wonder if that might be the same issue you're seeing.

    @Curtis, that is exactly the issue I am seeing too...

    Our common denominator is not the Multi-Network plugin (as I'm using Networks for WordPress) but I do have your Extended Super Admin plugin running ...

    Might that be influencing WP's thought process in URL handling here?

  7. Curtiss Grymala
    Member
    Posted 2 years ago #

    @RavanH - It shouldn't be (it doesn't have anything at all to do with URLs), but I'll run some testing to make sure.

  8. Curtiss Grymala
    Member
    Posted 2 years ago #

    Okay. I completely reset our WordPress installation. I deleted everything, downloaded the latest package, installed it, ran the installation/configuration, logged in and then performed the steps to set up a "network". After that, I added the Networks+ mu-plugin (no other plugins, mu-plugins or themes are installed) and added a few extra networks.

    With those steps, everything worked the way it should.

    However, I then realized I had failed to comment out the necessary lines in my wp-config.php file to make the "Network Admin" link (and logins) work the way it should.

    As soon as I commented out the following lines from my wp-config.php file, the top-level "networks" started doing the same thing again (adding the blogs.dir to the URL of the media, rather than rewriting it to the appropriate files location):

    define( 'DOMAIN_CURRENT_SITE', 'www.example.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    Did I comment out something I shouldn't have? I initially commented out the following line, too (since it occurs between the PATH_CURRENT_SITE and BLOG_ID_CURRENT_SITE definitions), but then uncommented it.

    define( 'SITE_ID_CURRENT_SITE', 1 );

    Do you see anything I might have done wrong? I even tried resetting the permalinks on one of the networks, and that still didn't help.

  9. RavanH
    Member
    Posted 2 years ago #

    Curtis,

    I've been looking at those lines before too since the instructions for NetworksforWordPress say that

    define( 'DOMAIN_CURRENT_SITE', 'www.example.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );

    should be commented out. Which I had. So I tried commenting out define( 'BLOG_ID_CURRENT_SITE', 1 ); too (so an inverted order of what you did but resulting in the same) to see if that would change anything. It did not change, so I left it all alone...

    What happens when you uncomment those lines again?

  10. It's all 4 lines.

  11. Curtiss Grymala
    Member
    Posted 2 years ago #

    After a bit more investigation, I've found that, if either (or both) of these lines are commented out, that's when it fails:

    define( 'DOMAIN_CURRENT_SITE', 'www.example.com' );
    define( 'PATH_CURRENT_SITE', '/' );

    I'm not sure why removing those lines is causing the issue, but it is. If I uncomment them both (again, they both have to be uncommented), the URL for the media begins working fine again. As soon as either of them is commented/removed again, the URLs for media on top-level networks go back to using blogs.dir instead of files.

  12. Curtiss Grymala
    Member
    Posted 2 years ago #

    @Andrea - Is your installation a fairly new install (since the merge) or was it originally a WPMU install? I'm wondering if maybe older installs don't have this issue (I may try installing WPMU, getting it set up, then upgrading to see if the issue reappears).

    Has anyone else been able to reproduce this issue?

  13. Yeah, it's an upgraded install.

    I read your post out to Ron, and before I got to those two lines, he guessed the ones you posted. ;P

    It makes sense to me, because clearly both those lines redirect some part of WordPRess into thinking that the main site is the head of the network. So the second network site - which is still a SUB site - has only part of the info it needs.

    Just make sure you comment out those lines. It *is* in the instructions. ;)

  14. David Dean
    Member
    Posted 2 years ago #

    If these problems are related to having the *_CURRENT_SITE constants undefined, then feel free to uncomment them. The decision to instruct commenting them out was based on my best reading of the site routing logic, and while it causes no problems on our install and many others, it's definitely worth considering as a source of issues.

    Unless there are more issues at play here, I'll change the instruction to a troubleshooting step. People seem to be running fine with those constants in place, and the fewer file edits needed the better.

  15. RavanH
    Member
    Posted 2 years ago #

    I've been running a multi-site setup with Networks for WordPress and

    define( 'DOMAIN_CURRENT_SITE', '....' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    in wp-config.php for a while now without problems.

    But the original issue of showing /blogs.dir/X/files/ in media URLs has not been solved. Not even for new networks created after the change to wp-config... :(

  16. Jani Uusitalo
    Member
    Posted 2 years ago #

    I'm chiming in with my experience just in case more reproducers are of any help. I've encountered the issue @RavanH described in the initial post on my multisite install: files uploaded onto the root blog get url's with blogs.dir while subsites (in subdirectories) get url's without it.

    I was running WPMU just prior to it getting integrated into WP proper, but unfortunately I can't say for sure whether I did a clean reinstall or an upgrade to WP (non-MU) at that point.

    I'm only running a single network with none of the plugins mentioned in this thread thus far. Well, no, actually I do run another multisite for testing purposes, completely separate from the first, and there this issue doesn't manifest.

    The upload-related variables for the main site are as follows:

    `Upload Url Path:
    Upload Path: wp-content/blogs.dir/1/files
    Fileupload Url: http://mummila.net/files`

    I suspect the Upload Path is what's causing this; further evidence is that on the testing site Upload Path: wp-content/uploads results in url's without blogs.dir.

    I'm thinking of changing Upload Path, but I'm unsure where it ultimately should point to. If wp-content/uploads results in corresponding url's, is that the default for the root blog? If so, is there a reason why it deviates from what the sub-sites have, which is sitepath/files? I'd expect the root site to have /files/ as attachment url base.

  17. Jani Uusitalo
    Member
    Posted 2 years ago #

    On a hunch, I instead opted to change Upload Url Path (of the main site) to point to where Fileupload Url already was pointing, and lo and behold, now the uploads get url's with a /files/ base (which I feel is best).

    Funnily, despite this same setting on the testing site, the url's there have the wp-content/uploads base (like I mentioned in the previous comment), as if Upload Url Path didn't have an effect. There doesn't seem to be a Fileupload Url setting there --- perhaps it's deprecated? (The testing site runs trunk, whereas the main site runs latest stable.)

    (Usually it's the other way round: something that works in testing won't work on the production site.)

  18. Funnily, despite this same setting on the testing site, the url's there have the wp-content/uploads base

    because it was a wordpress install which then had multsite turned on. :D WordPress knows if it's an upgraded mu install or not. That one was not.

  19. RavanH
    Member
    Posted 2 years ago #

    Jani, your hunch was amazing :)

    This actually fixed the issue on all of the secondary main sites (no idea how else to describe the main sites of secondary networks created with the Networks for WordPress plugin) but not in the main site of the main network... There it did indeed change the URL from using /wp-content/uploads/ to /files/ but from then on, images where not visible anymore, returning a 404.

    This is actually fairly logical since the /files/ url forces the files to be handled by WP instead of being requested and served directly. WP then searches inside the /blogs.dir/1/files/ subdir while the uploaded files reside in /wp-content/uploads/ ...

    On another WPMS installation (without Networks for WordPress) that I had installed straight as a Multi-site, not as a regular install first and then activating multi-site capabilities, the main site was using /blogs.dir/1/files/ as upload path and displaying that in the urls too. Here, your hunch saved the day again!

    Thanks for sharing :)

  20. On another WPMS installation that I had installed straight as a Multi-site,

    How on earth did you do this? put the multsite declaration in the config file right when you installed it?

    becasue this:

    a regular install first and then activating multi-site capabilities

    is how you're supposed to do it.

  21. RavanH
    Member
    Posted 2 years ago #

    How on earth did you do this? put the multsite declaration in the config file right when you installed it?

    As far as I remember, yes. This resulted in the main site using /blogs.dir/1/ instead of /wp-content/uploads/

    But I actually see it as an advantage now with the fix from Jani Uusitalo, as now the main site also uses /files/ which looks better than /wp-content/uploads/ to me... but that's a personal thing ;)

    Maybe this might be a little improvement for WP's installation routine? A little check for right after network activation, something like: "when the main site uses Upload Path: wp-content/blogs.dir/1/files" (instead of wp-content/uploads then "set Fileupload Url: http://domain.ext/files"

  22. Ehh..... nah, I think this is more because you were doing a non-standard install routine. They'd have to add too much logic in WP to check if someone was enabling multsite during the main install process, when you really should install first, enable multiste second.

  23. RavanH
    Member
    Posted 2 years ago #

    Well, clearly I'm not the only one making this 'mistake' of going for multi-site from the start... and it seems to have no other downside than this visibility of blogs.dir in media urls. The fix sounds easy enough and allows for more flexibility in the installation process.

    Anyway, my second issue remains: on the multi-site installation where I did follow the correct installation procedure, and where I am using the Multi-network plugin, all secondary networks need to have this fix (setting the Upload Url Path option) applied manually to replace the /wp-content/blogs.dir/X/files/ with /files/ in all media urls. I'll open a new thread about it to not confuse the original issue further.

    Thanks guys & galls, I've marked this as solved :)

  24. Jani Uusitalo
    Member
    Posted 2 years ago #

    Np, @RavanH, glad my contribution turned out helpful!

Topic Closed

This topic has been closed to new replies.

About this Topic