WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Images not found on subsites because of the rewrite issue? (7 posts)

  1. ddramer
    Member
    Posted 1 year ago #

    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.

  2. Is this a brand new 3.5 install?

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

  3. ddramer
    Member
    Posted 1 year ago #

    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.

  4. 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?

  5. ddramer
    Member
    Posted 1 year ago #

    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.

  6. Lindley White
    Member
    Posted 1 year ago #

    Ddramer:

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

  7. ifmeister
    Member
    Posted 11 months ago #

    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]

Topic Closed

This topic has been closed to new replies.

About this Topic