• Resolved [email protected]

    (@guidoredgmailcom)


    First than all, yes, I have readed a lot about the theme, so i can firmely set that the new media library code broke uri/url on multisite configuration.
    I have a 3.5.1 subdirs Multisite, upgraded from 3.0 periodicaly, so the multisite databases has been upgraded since then. I use the default .htaccess and the wp-config taked from older versions, but the recent upgraded to 3.5.1 broke the images/documents links of all my media library subsites, and administration icons using ozh-admin-manager. The main site uses icons, images and docs fine.
    Differences:
    Main site uses url like this: https://site/wp-content/uploads/docs
    Subsite uses url like: https://site/subsite/files/docs
    the real address are: https://site/wp-content/blogs.dir/id/files
    I linked wp-content/blogs.dir with wp-content/uploads/sites, does’t work.
    And at last I found somthing that make me think on code broking the process that transforms urls…
    Inside .htaccess I added this line to the begin of rewrites rules
    RewriteRule ^([_0-9a-zA-Z-]+/)?subsite/files/(.+) wp-content/blogs.dir/id/files/$2 [L]
    And all works just for this subsite … so I need to add a rule to every subsite to make all subsites work … practical but not well manage.
    Can please recheck why this rule works and all the rest that should do the same don’t?
    Thanxs.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Main site uses url like this: https://site/wp-content/uploads/docs
    Subsite uses url like: https://site/subsite/files/docs
    the real address are: https://site/wp-content/blogs.dir/id/files

    That’s not wrong. That’s how it’s supposed to be for WP Multisites created from 3.0 through 3.4. If you originated Multisite in 3.5 it’s different, but it’s neither here nor there since you UPGRADED to 3.5.1 ??

    Read https://codex.www.ads-software.com/Multisite_Network_Administration#.htaccess_and_Mod_Rewrite

    Make sure your .htaccess is correct.

    Thread Starter [email protected]

    (@guidoredgmailcom)

    I appreciate a lot the quick answer, but I need to repeat, I had readed a lot, even that document (and others) from where I found the rewrite rule to make it works for a particular subsite.

    And yes, I know that configuration and urls are right (that’s not wrong) since they are the expected ones. The wrong is the code that doesn’t match one with the proper other. More explicity:

    WP Multisite url -> https://site/subsite/files/doc with wp-content/blogs.dir/id/files/year/month … it allways fail! … some where this match its not well created. And why I assume that, just because the rawrite rule I must add to fix this manually that efectively do that.

    More data on this, My .htaccess …

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files per subsite
    RewriteRule ^([_0-9a-zA-Z-]+/)?guido/files/(.+) wp-content/blogs.dir/3/files/$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    And I can add two new data fields, the network management site’s fields for multisite guido:
    Upload Path: wp-content/blogs.dir/3/files
    Fileupload Url: https://academia.uaa.mx/files

    Fileupload had been changed to ../guido/files, ../guido/uploads (nothing) and nothing fix the broken links.

    Personaly, I think the first is used a lot because the upload works fine until it’s changed … but the second, you can change it, erase it, or set it by default and no links to multimedia works, all the links stay broken.

    Other tip. I used a download plugin to make the links work and efectively, they work through the download link, avoiding the url transform process, but it’s not the fix that needs to be done.

    Any idea?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    If you had read and compared you would see that you are MISSING a line in your .htaccess.

    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    Thread Starter [email protected]

    (@guidoredgmailcom)

    No, I don’t. Sorry, I readed that before (earlier to the decision of write this), I added that before (prior to version on the previous message), tested, and didn’t work (disposed). Also in all the read process I found a lecture that talk about the ms-files. It states they are ignored by new versions (3.5+).

    So, this point is irrelevant, and the statment about broken code stays as the main topic.

    Any suggestion?.

    OK, lets implement something different and new. Lets asume that some wp-variables are involved in the process to decide how to translate the wp-url to the site-url path. Someone knows exactly wich ones are in 3.5+ code?. Once stablished wich ones I can trace it in the code.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    No, I don’t. Sorry, I readed that before (earlier to the decision of write this), I added that before (prior to version on the previous message), tested, and didn’t work (disposed).

    Without that line, /files/ will never work, so while it may not be all of your problem, it’s most likely some of it. Please put it back in so we can KEEP debugging.

    Inside .htaccess I added this line to the begin of rewrites rules
    RewriteRule ^([_0-9a-zA-Z-]+/)?subsite/files/(.+) wp-content/blogs.dir/id/files/$2 [L]
    And all works just for this subsite … so I need to add a rule to every subsite to make all subsites work … practical but not well manage.

    Again the reason you want THIS code is because it’s checking for ‘anything/files/anything2….’ and passing it to wp-includes/ms-files.php?file=anything2

    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    So

    1) Put that code BACK in.

    2) Go to a site with a broken image (like domain.com/sub/files/2013/02/blah.jpg)

    3) Take that URL and visit domain.com/sub/wp-includes/ms-files.php?file=2013/02/blah.jpg

    What happens?

    Thread Starter [email protected]

    (@guidoredgmailcom)

    OK! … it works!!! … You are right. I’m wrong. Bit is not just put this line … is where do you must put it inside the .htaccess file … I needed to read the document on https://www.onextrapixel.com/2011/07/07/the-ultimate-wordpress-multi-site-network-management-guide/ to figure out where it must be added.

    My new .htaccess has now:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files per user
    # RewriteRule ^([_0-9a-zA-Z-]+/)?guido/files/(.+) wp-content/blogs.dir/3/files/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    So. To all that has the same trouble … that’s the fix!. But, ups… the oz-menu manager for network has links broken still … that’s another history to tell!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Multisite and Media Library broke documents uri/url’ is closed to new replies.