• patung

    (@patung)


    I have a very old but up to date multisite installation where all the images are broken on the sub sites, but fine on the main site, which is in root. The actual images are located at, for example,

    /public_html/wp-content/blogs.dir/7/files/2010/06/file.jpg

    but wordpress outputs it as:

    https://sub.domain.com/files/2010/06/file.jpg

    and it gives a 404 error, and I can’t view or edit the images in the Media Library.

    This is htaccess

    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]

    This is wp-config

    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'www.mymainsite.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

    I’ve read lots of threads on this but if htaccess and wp-config are correct I’m not sure what I’m supposed to do to fix it.

    Web server is nginx/1.17.5

Viewing 5 replies - 1 through 5 (of 5 total)
  • Web server is nginx/1.17.5

    Nginx doesn’t handle .htaccess files at all, so the rules above will all be ignored.

    You’ll need to have equivalent Nginx-specific redirect rules to take care of this. If this is not up your alley, I suggest you get in touch with your host for assistance.

    Good luck!

    @patung
    Have you solved the issue? If yes can you share how?
    I’m running into same problem.

    @nichesite: Are you also using Nginx webserver (and not Apache) as the OP?

    @gappiah

    OP?
    Its Litespeed

    I copied all directories from /wp-content/uploads/sites/62/…
    to /wp-content/blogs.dir/62/files/…

    Now it seems fine.

    • This reply was modified 4 years, 7 months ago by nichesite.

    OP = Orignal Poster.

    Two websites can be experiencing a similar problem (eg 404 errors) but the cause of the problem — hence the solution — can be totally different due to the different hosting environments.

    In the OP’s case, he/she is using Nginx. Nginx doesn’t support Apache’s .htaccess directives at all, so ALL the codes provided were ignored by the web server, and the solution was to find the correct WordPress permalink rewrite rules for Nginx.

    In your case, Litespeed supports Apache’s mod-rewrite rules and other .htaccess directives, so the root cause of your 404 errors (hence the solution) would be very different.

    That’s why it’s always advisable to start a new thread!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sub Site Images 404’ is closed to new replies.