• Leo Antonioli

    (@lantonioli)


    I have been using WordPress Multisite for a long time, but recently things have started to break… I would like advice to migrate my content to a new installation of WordPress Multisite (on the same server, with the same subsites and domains) or fix my htaccess.

    The installation was originally made before version 3.5 and is updated to the latest version (5.6.2). But it contains inheritances from previous versions (ex: stores uploads in wp-content/blogs.dir instead of wp-content/uploads/sites).

    About 15 days ago, the images “disappeared” from all subsites of this installation. The problem is a 403 error (Forbidden) in all uploaded files.

    The file permissions are ok. I disabled all plugins. In a new WordPress Multisite install (for testing, on the same hosting – Hostgator), the images appear correctly. So the problem is only with my old installation.

    I think the problem is in htaccess, but I can’t solve it myself. I would like help to resolve this or advice to migrate the content to a fresh installation of WordPress Multisite.

    I find this topic and i can solve it partially if If I put RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-content/blogs.dir/<em><SITE_ID></em>/files/$2 [L] before the #uploaded files line. But I can’t do this for all the 15 subsites.

    My root htaccess:

    # force HTTPS
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    # BEGIN WordPress
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    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

    The page I need help with: [log in to see the link]

  • The topic ‘Problems with htaccess on a Granny WordPress Multisite’ is closed to new replies.