WordPress.org

Ready to get started?Download WordPress

Forums

Help! Uploads path issue after server move (10 posts)

  1. ashbydesign
    Member
    Posted 1 year ago #

    Despondency setting in. Anyone who can suggest something I'm very happy to try things.

    Here's what I've done:
    1) Update wordpress before move from 3.4.2 --> 3.5.2 (ALL WORKING FINE)

    2) Move to new server - blogs are working as expected (able to set up new ones fine), however, the paths to subdomain images are broken (i.e. I can upload images fine - but they are showing as broken at the front end and in the media library)

    MY CHECKS

    1) htaccess is as follows:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    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]
    </IfModule>

    # END WordPress

    2) The URL to images is as anticipated - i.e. blog.domain/files/y/m/d/imageurl

    3) Checked under Network Admin > Sites > [site] Settings to check the path to the actual blogs.dir folder is ok (where # is no. of blog)
    wp-content/blogs.dir/#/files

    ****
    My backups for the site show htaccess as above. I'm not sure why the generated Network Setup htaccess code is as follows. I've tried substituting this code - and it makes no difference, though.

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

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    Once more… any help, much much appreciated. Mel

  2. ashbydesign
    Member
    Posted 1 year ago #

    OK - I can see that the Network Setup htaccess code makes provision for wordpress 3.5 AND for the older uploads system to the blogs.dir (instead of sites). So, I've now changed my htaccess file code to this - I presume this is correct…?

    Still no difference to the issue I am having concerning the image upload path, however.

    Another check I've run:

    blog.domain/wp-includes/ms-files.php?file=2013/05/image.jpg

    - produces the same missing image link.

  3. ashbydesign
    Member
    Posted 1 year ago #

    Is there anyone who might be able to help? I'll happily donate for a bit of assistance here. The network is supposed to be live and I'm getting people asking why it's not… I'm

  4. Don't bump. The forums are staffed by volunteers and we all have day jobs.

    You moved servers. Did you check if your new server supports Multisite? The first place I'd check would be to see if my httpd.conf has AllowOverride set to 'all' or 'options all'

  5. ashbydesign
    Member
    Posted 1 year ago #

    Sorry about that… it still amazes me that people are so generous with their time, so I'll not do that again. The second post was an edit but the third was me getting desperate at the end of my working day (UK) and sounds cheeky.

    I've sent a message to the server re. httpd.conf and await an answer. I'm pretty sure the new server config is the same as the old but will check. One thing is that the new server has Incapsula security set up on it, so I am wondering if this might be causing issues (am new to it). Will investigate.

  6. Incapsula CDN I've used, but not security... It's possible.

    The httpd.conf setting is the most common 'miss' for new servers. Most things don't need it, but the fact that blog.domain/wp-includes/ms-files.php?file=2013/05/image.jpg is broken too means that something's stopping PHP from behaving right.

    You may also want to check your php error logs.

  7. ashbydesign
    Member
    Posted 1 year ago #

    No luck so far. All seems fine - httpd.conf good. No php error logs appearing. Images are uploaded as expected - they are just not visible in blog admin or on the blog front end.

    See ageofwe.org - open at the moment though broken on blogs images - it's being looked at by another tech to see if they can figure.

  8. Is ms-files.php still there?

    Honestly I might actually do this - http://halfelf.org/2012/dumping-ms-files/

    Get rid of MS Files all togteher. You don't need it anymore.

  9. ashbydesign
    Member
    Posted 1 year ago #

    Thanks for getting back to me Mika

    I have been thinking along the lines of what you're suggesting, but I'm not remotely qualified to attempt it on guesswork and I hadn't found your post when searching.

    So… I'm not a deep coder - please bear with me. Would you mind if I check the following points with you before I wade into the deep end.

    1) Back up!

    2) Move each site's images - I'll be doing it manually by FTP (I've never used command line)

    ** I'm confused, all this rewriting is doing my head in. I DO or DON'T need the /files/ directory for each site?

    For instance, should I move from -- blogs.dir/10/files/2013/01/image.jpg
    to -- uploads/sites/10/2013/01/image.jpg
    or to -- uploads/sites/10/files/2013/01/image.jpg

    3) Manually edit site paths in Network Admin:

    Upload Path = wp-content/10/files (was wp-content/blogs.dir/10/files)
    Upload Url Path= wp-content/uploads

    4) Do a database search/replace in phpmyadmin on each site posts table (because I prefer the safe and sure method)

    UPDATE wp_10_posts SET post_content = REPLACE (
    post_content,
    '="http://ageofwe.org/files/',
    '="http://ageofwe.org/wp-content/uploads/sites/10/');

    5) Add the following to wp-config

    define( 'UPLOADBLOGSDIR', 'wp-content/uploads/sites' );

    6) More database action. Ok… not sure what I do in phpadmin to do this - how to go about it?

    INSERT INTOmy_database.wp_sitemeta(meta_id,site_id,meta_key,meta_value) VALUES (NULL, '1', 'ms_files_rewriting', '0');

    7) If it don't work for sites, try your patch-em-up function

    function stupid_ms_files_rewriting() {
            $url = '/wp-content/uploads/sites/' . get_current_blog_id();
            define( 'BLOGUPLOADDIR', $url );
    }
    add_action('init','stupid_ms_files_rewriting');

    8) comment out ms-files line in .htaccess

    9) Cross fingers no weirdness - check path options under sites

  10. For instance, should I move from -- blogs.dir/10/files/2013/01/image.jpg
    to -- uploads/sites/10/2013/01/image.jpg
    or to -- uploads/sites/10/files/2013/01/image.jpg

    uploads/sites/10/2013/01/image.jpg

    3) Manually edit site paths in Network Admin:

    This may not be needed. In fact, if you blank those out, it should work.

    5) Add the following to wp-config

    Also may not be neeed any more.

Topic Closed

This topic has been closed to new replies.

About this Topic