WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] Multisite image path error (37 posts)

  1. aizik
    Member
    Posted 4 years ago #

    Hi

    Upgraded from 2.9 to 3.0 b2. Everything seems to be working fine except that newly uploaded images are not displayed.

    The generated url for a new image is (what appears in the source code for a page):
    http://site.com/files/2010/05/image.jpg

    The image appears broken.

    Opening the following address does works:
    http://site.com/wp-content/files/2010/05/image.jpg

    The images are uploaded to the correct directory the only problem is with the "/wp-content/" added to the url.

    Any ideas? Thanks!

    ps. I have to sites, both showing the same problem. The first one was converted, the second one is new. Also, I started with subdomains and then changed to subdirectories. To change to subdirectory I modified wp-config and htaccess.

  2. Anointed
    Member
    Posted 4 years ago #

    I have the same problem both on upgraded wpmu sites and virgin 3.0 multisite setups.

    Actually it should not be /wp-content/files/...

    We are completely missing the /wp-content/blogs.dir/blogid/files path creation.

    So all sub domain sites from upgrade are going to be broken image paths even with the wp-content added in.

    It's like the entire directory process is screwed up when enabling multisite in 3.0

  3. No, it SHOULD be /files :)

    In your .htaccess, you should have this:

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

    And that should redirect you just fine.

    Check that your full .htaccess is something like this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    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]
    </IfModule>
    # END WordPress

    (I'm using subfolders, not subdomains FYI)

  4. Anointed
    Member
    Posted 4 years ago #

    @Ipstenu
    Thanks, turns out I had the 'generic' htaccess file.

    I guess that I am just used to running wpmu with the /blogs.dir/blogid/ system path.

    With 3.0 now it seems that all the files are simply saved into the /wp-content/uploads folder, which seems really strange to me. Wondering how wp is going to separate out all the files for different sub domain sites without those folders. Suppose I'll soon find out.

    thanks again.

  5. The files are saved to /wp-content/blogs.dir on my server for multisite. That said, all my OLD files, from before MSing, were back on /uploads/ so I had to do some fakery and SQL queries to move them. But. Most people are probably not going from 'Massive established single site' and into 'multiple sites!'

    Actually, having done it, I would tell people NOT to do it unless you have to. :)

  6. Anointed
    Member
    Posted 4 years ago #

    Unfortunately for me I do have a massive single-install wp (30k members, large amt of posts/media/forum posts) that is going to become a multisite 3.0 install when 3.0 goes final.

    I also have a few wpmu sites that will become multisite3.0.

    Finally I have a few new installs of 3.0 where I am playing around. I've noticed that as soon as I switch on multisite, that the folders are remaining the same. Even though I manually create the blogs.dir as specified, files still are saved in /files/

    I'm just glad that I am doing very extensive testing in many situations prior to upgrading all my client and personal sites. So far it's nowhere near as smooth as I'm sure wp plans it to be.

  7. The MU to MS ones will be easy. I did that and they had no issues, no files, etc.

    Finally I have a few new installs of 3.0 where I am playing around. I've noticed that as soon as I switch on multisite, that the folders are remaining the same. Even though I manually create the blogs.dir as specified, files still are saved in /files/

    Are the files actually saved in the /files/ directory, or is that just where the image URLs point to?

    At a wild guess, if you create a single site, configure etc, use it and THEN switch to multi, you may need to 'fix' the folders to blogs.dir.

    Either way, on MS, your URL will always say 'files'.

    Unfortunately for me I do have a massive single-install wp (30k members, large amt of posts/media/forum posts) that is going to become a multisite 3.0 install when 3.0 goes final.

    It can be done, it's just a pain. If you're good with SQL and htaccess, it's no so bad. I had to move from a custom upload folder to blogs.dir, which involved a lot of copying files and then running SQL commands to fix posts after I ran the upgrade on the 'main' blog.

    Then I imported the child blogs as import/export and ran the SQL fixes again for that blog.

  8. aizik
    Member
    Posted 4 years ago #

    My htaccess file seems fine, so my problem should be something else. Here is my htaccess

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    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]

    My guess is that it could be something in the site option. I was thinking that the upload path (although the files are being uploaded to the correct directory, just not displaying)
    My Upload Path is:/public_html/intranet/files/ (intranet is where wordpress is installed)

  9. Go into Network Settings -> Sites and click on EDIT for your blog.

    The URL will be something like http://domain.com/intranet/wp-admin/ms-sites.php?action=editblog&id=1

    Scroll down to Upload Path and see what's in there. It SHOULD be wp-content/blogs.dir/1/files

    And that's okay :)

  10. Anointed
    Member
    Posted 4 years ago #

    value is: wp-content/uploads

    I also can confirm that I do have mulsites=yes, and do have the option of adding sites.

    Somewhere along the line during install, something must have gone terribly wrong.

    Thankfully this is only my sandbox site, but at least it shows me that I need to try a fresh install again, prior to even thinking about moving 'live' sites to 3.0. I should make sure, triple check, that the data paths are now being setup correctly in 3.0 when switching to multi.

    It's just to bad that 3.0 does not give option during install for multi, where it could then make sure all file changes are made and directories are created properly before the db is even populated. Would have been much cleaner then.

  11. Obviously you can change it manually, but. That's beside the point!

    If it happens a second time, I'd open up a trac ticket and detail exactly, down to the gnat's backside, how you installed and what you did BEFORE switching to MultiSite.

  12. aizik
    Member
    Posted 4 years ago #

    Changed the upload path to wp-content/blogs.dir/1/files

    The files are uploaded to the right directory

    Still do not display (actually they display ok in Chrome, the browser I used to upload them, but not in any other browser).

    http://intranet.mayoreoelectrico.com/files/2010/05/mem_small.png does not display
    http://intranet.mayoreoelectrico.com/wp-content/files/2010/05/mem_small.png works

  13. Both links are 403 (Forbidden) for me.

    Actually, so is http://intranet.mayoreoelectrico.com/

  14. Re the email... His site's blocked by IP, which makes sense since it's internal only! :)

    It really wouldn't matter if I saw it or not. I was just wondering what the actual error messages were (sometimes looking at a blog helps click things).

    Anyway. What plugins are you running? Is that the FULL .htaccess?

    I'm not sure why it wouldn't parse unless it can't 'see' files, which is very odd. If I put /wp-content/ into my image URL, it redirects to /files/ so you've got to be missing something...

  15. aizik
    Member
    Posted 4 years ago #

    Yes, the site is blocked by IP, I posted the link for reference only as an example...

    Why could it be that the file path with wp-content is working but not without it?

    I've gone through the htaccess and it seems ok, also the Upload Path site option and the files are uploading correctly.

  16. Is there anything else in the .htaccess that might be conflicting?

  17. aizik
    Member
    Posted 4 years ago #

    I don't think so... this is the full htaccess file:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    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]
    
    # END WordPress
    
    AuthUserFile 	/dev/null
    AuthGroupFile 	/dev/null
    AuthType 	Basic
    AuthName 	"AllowFrom"
    
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from xx.xx.xx.xx
    </Limit>
  18. Can't hurt to try wrapping it in <IfModule mod_rewrite.c> ... </IfModule>

    Second thought, on the Tools -> Network page, what does IT say your .htaccess should be?

    Also double check your wp-config's set up correctly with the right domain and basepath and all.

    Are you running any sort of redirect plugins?

    And at a last gasp, I suppose putting in this to your htaccess would help:
    RewriteRule ^files/(.*)$ http://domain.com/wp-content/files/$1 [L,R=301]

    (In the back of my head, I have this ... idea that something with your installation path is the cause, but I just can't lock down on that thought.)

  19. @annointed if you do find something you think the devs shoudl look at then, please please please file a trac ticket so they can look at it?

  20. aizik
    Member
    Posted 4 years ago #

    I added the <ifmodule> nothing changed.

    The htaccess is eaxctly the same as in Network page.

    wp-config I'm not sure if everything is ok. It is as follows:

    <?php
    /**
     * The base configurations of the WordPress.
     *
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys, WordPress Language, and ABSPATH. You can find more information by
     * visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
     * wp-config.php} Codex page. You can get the MySQL settings from your web host.
     *
     * This file is used by the wp-config.php creation script during the
     * installation. You don't have to use the web site, you can just copy this file
     * to "wp-config.php" and fill in the values.
     *
     * @package WordPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'mayore99_wp');
    
    /** MySQL database username */
    define('DB_USER', 'XXXXXX');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'XXXXXX');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    
    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    
    /** Activar Hyper Cache plugin */
    
    define('WP_CACHE', true);
    
    /** Activar MultiSite */
    
    //define('WP_ALLOW_MULTISITE', true);
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'intranet.mayoreoelectrico.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );
    
    define( 'AUTH_SALT', '~t+x0O+;<code>e;z37Mj49s</code>@a-T%HPbj}~T9Jz[PqT*pP(la)+HgG_nei~-N<w-88vh' );
    define( 'SECURE_AUTH_SALT', 'b}2<{J(5Vy~@N.c3F+i.n<@K]AuIP}bvT+s~8a}@.M) gI4H+A|<{pK!:2A9Q,9I' );
    define( 'LOGGED_IN_SALT', 'pdKWCuGk/d~[njgrx4HK,d!x?mihs7z|
    
    Gyx|Sqih0U:BF8pXPr|{+WKV[WWi8Cs' );
    define( 'NONCE_SALT', 'ofa$N
    
    KkC%,EDSZ>e{wTxV^{e@>0NnVZn#3]q]kzZgI.uW{/w#!dPD-F8yf~(HW<' );
    
    /**#@+
     * Authentication Unique Keys.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}
     *
     * @since 2.6.0
     */
    define('AUTH_KEY', 'XXXXX');
    define('SECURE_AUTH_KEY', 'XXXXXX');
    define('LOGGED_IN_KEY', 'XXXXX');
    define('NONCE_KEY', 'XXXXX');
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each a unique
     * prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix  = 'wp_';
    
    /**
     * WordPress Localized Language, defaults to English.
     *
     * Change this to localize WordPress.  A corresponding MO file for the chosen
     * language must be installed to wp-content/languages. For example, install
     * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
     * language support.
     */
    define ('WPLANG', 'es_ES');
    
    /* That's all, stop editing! Happy blogging. */
    
    /** WordPress absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');
    ?>

    Not sure if the Abspath would have anything to do with it.

    On one of the sites I do have many plugins active, but on the other 2 sites there are no plugins and the same happens.

    Thanks again...

  21. Where's the actual location the sever?

    If I had a subdomain setup like you do, mine would be at /home/ipstenu/public_html/intranet (for example). I have no idea if it's relevant or if I'm grasping at straws! *sigh*

  22. aizik
    Member
    Posted 4 years ago #

    The actual location is:

    /home/mayore99/public_html/intranet

  23. aha! If it is indeed the main site in the install, that's probably why. But it may still need looking at.

  24. aizik
    Member
    Posted 4 years ago #

    andrea, what do you mean?

  25. aizik
    Member
    Posted 4 years ago #

    This is stranger than I thought. Now I'm convinced that the redirect is working in Chrome but nothing else. In Chrome I can download uploaded files, see images, etc. and the same url does not work in Safari, Firefox or IE.

    What is going on?!

  26. Frumph
    Member
    Posted 4 years ago #

    check your database for the mainsite for the fileupload_url option in the wp_1_options database table.

    there are cases where it doesn't get created

  27. aizik
    Member
    Posted 4 years ago #

    Bingo!

    I don't see a wp_1_options table. There is a wp_options table that has the information for the main site.

    What should I do now?

    These are the tables I have:
    `help_desk
    help_desk_knowledgebase
    help_desk_ticket
    wp_3_commentmeta
    wp_3_comments
    wp_3_links
    wp_3_options
    wp_3_postmeta
    wp_3_posts
    wp_3_terms
    wp_3_term_relationships
    wp_3_term_taxonomy
    wp_3_ue1_cache
    wp_4_commentmeta
    wp_4_comments
    wp_4_links
    wp_4_options
    wp_4_postmeta
    wp_4_posts
    wp_4_terms
    wp_4_term_relationships
    wp_4_term_taxonomy
    wp_blogs
    wp_blog_versions
    wp_bp_activity
    wp_bp_activity_meta
    wp_bp_friends
    wp_bp_groups
    wp_bp_groups_groupmeta
    wp_bp_groups_members
    wp_bp_messages_messages
    wp_bp_messages_notices
    wp_bp_messages_recipients
    wp_bp_notifications
    wp_bp_xprofile_data
    wp_bp_xprofile_fields
    wp_bp_xprofile_groups
    wp_calendar
    wp_calendar_categories
    wp_calendar_config
    wp_commentmeta
    wp_comments
    wp_connections
    wp_connections_terms
    wp_connections_term_relationships
    wp_connections_term_taxonomy
    wp_eg_attachments_clicks
    wp_eventscalendar_main
    wp_faqtastic_groups
    wp_faqtastic_questions
    wp_faqtastic_related
    wp_links
    wp_options
    wp_pollsa
    wp_pollsip
    wp_pollsq
    wp_postmeta
    wp_posts
    wp_registration_log
    wp_signups
    wp_site
    wp_sitemeta
    wp_statpress
    wp_tdomf_table_edits
    wp_tdomf_table_forms
    wp_tdomf_table_sessions
    wp_tdomf_table_widgets
    wp_terms
    wp_term_relationships
    wp_term_taxonomy
    wp_ue1_cache
    wp_usermeta
    wp_users `

  28. How weird. I don't have the fileupload_url setting in 2 of my four sites on an multisite site, but I have no issues.

    I have upload_url_path of course, but no fileupload_url. In specific, I don't have it on the two blogs I imported to Multi Site, but I DO have it on the two I created after the 3.0 jiggering.

    FYI, added them in and nothing bad happened. It looks like these aren't getting created? http://core.trac.wordpress.org/ticket/13483 implies that they're NOT needed, though. Confused!

  29. aizik
    Member
    Posted 4 years ago #

    It worked!

    I feel bad to admit that the problem was something simpler. The Hyper Cache plugin was breaking the links. I had purged the Cache and the plugin was only active for 1 of the sites but it still affected all of them.

    Thanks for all the help!

  30. Abigail
    Member
    Posted 4 years ago #

    I have the same problem, my .htaccess is okay and is exactly the same as what's posted above.

    Upload Path: wp-content/blogs.dir/8/files
    Fileupload URL: http://christianpinoys.com/news/files

    When I upload a sample image on one of my sites on the network, I get this url: http://christianpinoys.com/news/files/Winter.jpg - it doesn't show up

    I'm a noob and I don't really understand what's wrong with it. Help anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.