WordPress.org

Forums

[resolved] multisite htaccess media files problem (11 posts)

  1. pfilias
    Member
    Posted 3 years ago #

    I've seen a handful of posts around the internet where folks are having issues with their multiste installations and the proper handling of uploading files (images) into the media library.

    When I upload files on any site other than my first site (site ID = 1), the files make it into their respective folder: wp-content/blogs.dir/i/files/yyyy/mm/*

    However, it seems the .htaccess file can never properly route the server to serve up the media necessary.

    I've gone through istentu's (however he spells his username) 3 point checklist and they all seem to work, even using the ms-files.php checker.

    So when I go back into my media library, 1) The thumbnails don't show up, and 2) The webserver asks me for a Username and Password.

    I'd love to get this solved, as it seems I have the some issue on multiple multisite installations I have out there.

    Here is how I have my .htaccess (I've gone all the way down to the vanilla version):

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress

    And this is my wp-config.php file:

    // You can have multiple installations in one database if you give each a unique prefix
    $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
    
    // Change this to localize WordPress.  A corresponding MO file for the
    // chosen language must be installed to wp-includes/languages.
    // For example, install de.mo to wp-includes/languages and set WPLANG to 'de'
    // to enable German language support.
    define ('WPLANG', '');
    
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', '-------' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    
    /* That's all, stop editing! Happy blogging. */
    
    define( 'SUNRISE', 'on' );
    
    require_once(ABSPATH.'wp-settings.php');
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    ?>

    I've taken out the "secret" stuff, obviously.

    Also, I even tried this:

    RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L]

    But wasn't able to make that work. Am I supposed to use one of those per site IDs I have? I tried that, too, and it didn't work.

    Any help would be greatly appreciated.

  2. pfilias
    Member
    Posted 3 years ago #

    Nobody has any help to offer here? I've pretty much done a vanilla multsite installation and can't get media to show up for any site other than id=1.

    Please help.

  3. Please don't bump.

    Also pay attention to WHERE you post :) Multisite has it's own sub-forum (where I've just moved this post), and that's where we hang out to fix Multisite problems.

    Also it's Ipstenu (and I'm a she, not a he).

    Now that all that's cleared up.

    So when I go back into my media library, 1) The thumbnails don't show up, and 2) The webserver asks me for a Username and Password.

    The webSERVER is asking you for a user name and password? You mean it asks you for the same password/ID combo you use to FTP?

  4. pfilias
    Member
    Posted 3 years ago #

    Sorry about all that.

    The webserver is asking for a username and password, and it's NOT the same as FTP or any other login credentials I use for that matter.

  5. Interesting. Well, that's a problem (if not the problem).

    Did you password protect any folders perchance?

  6. pfilias
    Member
    Posted 3 years ago #

    Well, there is one on this account, but shouldn't be related, should it?

    It's in the account's /files folder, where I keep some tools I need from time to time.

  7. It could be related, yes.

    However, it seems the .htaccess file can never properly route the server to serve up the media necessary.

    That's a mod_rewrite issue. (Yes, really.) Same issue that results in things here:
    http://wpmututorials.com/installation2/subfolder-blog-have-no-theme-styles/

    But you also have to figure out why it's coming up with a password - that's definitely server related outside WP.

  8. It's in the account's /files folder, where I keep some tools I need from time to time.

    ...

    Given that WordPress points to domain.com/FILES/2011/11/etc for your images? That's totally related.

    Rename your tools to 'my-files' or 'tools' or something.

  9. pfilias
    Member
    Posted 3 years ago #

    Holy moley!!!!! That was it. Thanks Rogue...that was "tight".

  10. You're welcome :)

    For those wondering, you CANNOT have a real folder with the same name as a virtual one, or things like that happen :) Names of folders NOT to use:

    /files
    /blog

    ANYTHING you use for your blog names (i.e. if you have a site named foobar, don't make a folder /foobar )

  11. pfilias
    Member
    Posted 3 years ago #

    Dear Jesus,

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic