Support » Fixing WordPress » After moving site to new server, image uploads are all 404

  • Moved a website from one server to another server and everything seems correct with the exception of all uploaded images are showing as 404. Both servers run debian lamp.

    The website was using multisite at one time but that functionality was turned off via wp-config.php some time ago.

    This means that the uploaded files are stored in /wp-content/blogs.dir/1/…..

    I have checked all ownership and permissions on the files and they are correct. The htaccess file is the same as the old server etc.

    At this point I just need some other ideas as to where to look to fix this problem.

    Here is the .htaccess file contents, just in case….
    RewriteEngine On
    RewriteRule ^(.*/)?\.svn/ - [F,L]
    ErrorDocument 403 "Access Forbidden"

    RewriteEngine On
    RewriteBase /

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off

Viewing 8 replies - 1 through 8 (of 8 total)
  • Did you run a find and replace across the database to make sure all the file paths in the DB have been updated to correctly reflect the move?

    @bemdesign no I didn’t do that, first time hearing of it, I’ll try to find a guide for changing paths in the db. Actually rather shocked that any of that would be stored in the db and not a config variable, but will check non the less… thanks for pointer

    Well the site url and blog url are stored inside the database (under the options table). I’m just wondering if those haven’t been updated they may cause a file path issue elsewhere on the site. It’s worth checking for at any rate.

    Thanks, yes I checked the db and only the url is stored, no paths and that is correct as it didn’t change.

    once again thanks for advice, I’ll keep looking and post a solution when I get one.

    Hmmm. No plugins for media that might save and serialize the filepath in the database? And it’s not permissions? Same user accounts and file permissions?

    I’ll keep looking, but no, the options table is clean, no paths displayed. permissions are set, owner/user account is www-data as normal for unbuntu. File permissions are correct as everything works except uploaded images, which do upload but don’t display, thus leaving me with htaccess rewrite rules or other possible issues.

    have you checked your inner database as to any link related to your images been stored there?

    are you using any hotlink protection

    are you saying you can not directly access a file over http that you can navigate to by ftp and find its actual url?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘After moving site to new server, image uploads are all 404’ is closed to new replies.