WordPress.org

Support

Support » Multisite » [Resolved] Images not found on subsites because of the rewrite issue?

[Resolved] Images not found on subsites because of the rewrite issue?

  • Hi!
    Im using WP 3.5 and whenever I upload a file through subsite wp-admin it wont be displayed.
    The image will be displayed with url path:
    http://www.domain.ltd/en/assets/sites/2/image.png

    Where “en” is the subsite subfolder and 2 is the subsite id.
    But when WP tries to display it, there is WP page not found .
    And I can access the file through:
    http://www.domain.ltd/assets/sites/2/image.png/
    (without the subsite subfolder)

    .htaccess:

    RewriteEngine On
    RewriteBase /
    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).*) wp/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
    RewriteRule . index.php [L]

    Everything else works but images.
    Can please somebody help me?
    No plugins used.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Is this a brand new 3.5 install?

    Did you do anything like define( 'UPLOADS', '/blog/wp-content/uploads' ); in your wp-config?

    Brand new install 3.5 and as I assume the new version now uses assets folder not blogs.dir anymore?
    And I havent set the wp-content/uploads in config either. Do I have to do that? The files are in place in assets folder and I can access them through my main site address but not from any subsite addresses.

    Brand new install 3.5 and as I assume the new version now uses assets folder not blogs.dir anymore?

    No, it uses /wp-content/uploads/sites/#/ for your subsites 🙂

    So the fact that its using ASSETS is something I would guess you changed on that main site before activating multisite?

    Yes found out that the loved template “Roots” was the cause.
    It replaces ‘uploads’ with ‘assets’ in the root directory as main UPLOAD folder.

    And WP rewrite doesn’t recognise any access to a custom folder from WP root.

    Ddramer:

    Did you figure out how to change it so that it does work while still using Roots?

    Hi. I managed to get around the problem adding these rules to the .htaccess file.

    RewriteRule ^assets/(.*) /<wp-project>/wp-content/themes/roots/assets/$1 [QSA,L]
    RewriteRule ^plugins/(.*) /<wp-project>/wp-content/plugins/$1 [QSA,L]
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Images not found on subsites because of the rewrite issue?’ is closed to new replies.
Skip to toolbar