Sub-site media files are uploading with the wrong URL

Hi, In my multi-site, installed in a subfolder, I upload images via the wp-admin Media page of a sub-site. These images are then displayed with a placeholder icon, the image URL is wrong:
http://mysite/templates/files/2017/07/ES-Orange-Logo-1.jpg
It should be showing the wp-content folder. Templates is the sub-site. Access is granted.

  • Adam Czajczyk

    Hello Jim,

    I hope you're well today and thank you for your question!

    I have moved your post from Members forum to our Support Forum. Members forum is for members discussion mostly rather than support questions and we might not notice support questions there sometimes. We also can't use support access feature from there.

    As for the issue. In case of a standard Multisite the URL should be like this:

    http://yoursite/templates/wp-content/uploads/site/123/2017/07/ES-Orange-Logo-1.jpg

    where "templates" is your subsite and the 123 number is an ID of that subsite. The URL that you shared suggests that the default upload path had been changed. This is usually made via a definition in "wp-content.php" file.

    Did you try to update/mask that default path?

    Otherwise, some plugins could be implementing some change but I'm not seeing any of that kind on site.

    Would you mind letting me access your server? You can provide me in a secure way with FTP and/or cPanel credentials by simply adding them to the text box on the "WPMU DEV -> Support" page under the support access button (this is internal to your site and won't get posted anywhere in public), just let me know here after you do this, please.

    Best regards,
    Adam

  • Predrag Dubajic

    Hi Jim,

    I had a look at your site and it looks like your installation is using some old multisite settings, that were user prior to WordPress 3.5 release.

    Can you tell me if this is newly installed WordPress or you updated from pre 3.5 version?

    The thing is that your upload path uses blog.dir in path and that was removed from 3.5 and it's probably what's causing the issues.

    Can you check the guide from here for possible fixes for this issue:
    https://codex.wordpress.org/Multisite_Network_Administration

    Best regards,
    Predrag

  • Jim

    Hi Predrag,
    This is actually a very fresh install. It is possible though that I have copied old code from the out of date suggestions found here in the discussions.
    I don't see where the upload path is defined. Which line is which file defines that?
    The link you gave shows the following as a correction for old installs:
    RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L]

    But as this is a new install it is probably a line of code I have copied in. But I am comparing what the WP page gives and I don't see what I am doing wrong.

  • Dimitris

    Hey there Jim

    The .htaccess rules proposed to you by WP here
    yourdomain.com/wp-admin/network/setup.php
    as indicating the old WP version my colleague Predrag mentioned before.
    Reference: https://codex.wordpress.org/htaccess#WordPress_3.4_and_below

    As this is a new installation, could you please try to replace all of these rules with the following snippet?

    RewriteEngine On
    RewriteBase /easysitesfortherapists.com/
    RewriteRule ^index\.php$ - [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]

    These are the default ones from here
    https://codex.wordpress.org/htaccess#WordPress_3.5_and_up
    with a little change in line#2 (RewriteBase /easysitesfortherapists.com/).

    Keep previous .htaccess file backed-up, just in case you have to revert it back! :wink:
    Looking forward for your results!

    Warm regards,
    Dimitris

    • Jim

      Hi Dimitris,
      OK, so I replaced the code and login. But I keep getting kicked out and have to log in again. Sometimes it won't accept the login and I need to retype the URL without the subfolder to get in again. Also try clicking on an image in the main media section. When I do that it logs me out. That doesn't happen with my previous .htaccess settings.
      The new updated .htaccess file is now loaded.

      Support access extended, login details on site.

      Thanks,
      Jim

  • Predrag Dubajic

    Hi Jim,

    I have added the .htaccess rules that are suggested by WP inside Settings > Network Setup panel and the subsite images are working fine now.
    I also tried navigating through your sites and I didn't get logged out so it looks like it's all working now.

    I have attached your original rules as a txt file so you can restore them in case that anything goes wrong.

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.