WordPress.org

Ready to get started?Download WordPress

Forums

Broken images on network blogs (WP3) (13 posts)

  1. exploding
    Member
    Posted 2 years ago #

    Hello,
    I know there are many "broken images" posts on this forum but I tried everything and I can't find the solution.

    I have a fresh install of WordPress 3.

    A main blog here:
    http://mycours.es/

    And a sub blog here:
    http://mycours.es/gamedesign2012/

    In the main blog the images work fine but in the other blog I can see them only if I'm logged as admin.

    This post is supposed to show an image
    http://mycours.es/gamedesign2012/2012/07/30/hello-world/

    The image file is here:
    http://mycours.es/wp-content/blogs.dir/2/files/2012/07/a.jpg

    But the image link is this one and returns internal server error (unless logged in)
    http://mycours.es/gamedesign2012/files/2012/07/a.jpg

    The upload path setting for that blog is:
    wp-content/blogs.dir/2/files

    And my .htaccess file looks like this:

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

    What am I doing wrong?

  2. Moving to Multisite.

    Read http://codex.wordpress.org/Multisite_Network_Administration#Uploaded_File_Path

    This line in your .htaccess is what magically translates things:
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    Normally when it doesn't work, it means your htaccess file isn't being read. Check your httpd.conf file and make sure that 'AllowOverride' has 'all' as one of it's options

  3. exploding
    Member
    Posted 2 years ago #

    I believe mod_rewrite is not enabled, it doesn't show up in the phpinfo
    http://mycours.es/info.php

    The .htaccess file is being read, at least in part, because if I rename it the blog in the subdirectory becomes unreachable.

    I just submitted a request to my host but I fear I may not have the control over httpd.conf. It's a relatively cheap commercial hosting solution. Am I doomed?

  4. Well... That would be a problem.

    mod_rewrite is 100% a requirement for Multisite. You need a better host.

  5. exploding
    Member
    Posted 2 years ago #

    Ok, I called my host and they say mod_rewrite is on. In fact I made an .htaccess file with RewriteEngine On and it doesn't throw an error.

    They say FollowSymLinks is also enabled and AllowOverride is set to all.

    Good news. But the problem remains :(
    Any other suggestion?

  6. exploding
    Member
    Posted 2 years ago #

    I reinstalled everything from scratch and the problem persists.

    This is the image
    http://mycours.es/wp-content/uploads/2012/08/a.jpg

    This is the url that doesn't get rewritten and throws a 500
    http://mycours.es/gamedesign2012/files/2012/08/a.jpg

    In the site settings
    upload path is: wp-content/blogs.dir/2/files
    upload url path is empty
    Fileupload Url is: http://mycours.es/gamedesign2012/files

    If there is no other solution I don't mind having unclean url/permalinks, but I don't even know if it's possible.

  7. exploding
    Member
    Posted 2 years ago #

    Or I can just rephrase the problem this way:

    How is it possible that the images and the url rewriting work when I'm logged in but not when I'm logged out?

    This is driving me insane O_o

  8. Do not. Touch. Site settings. Walk away. PLEASE I beg of you :) Unless you know WP like your hands, you don't want to mess with it (and even then, none of us want to). It's complicated and annoying.

    http://mycours.es/gamedesign2012/wp-includes/ms-files.php?file=2012/08/a.jpg

    and

    http://mycours.es/wp-includes/ms-files.php?file=2012/08/a.jpg don't work either.

    Which means it's still .htaccess. Ask your host if AllowOverride has 'All' set?

  9. exploding
    Member
    Posted 2 years ago #

    Do not. Touch. Site settings.

    Ok, changing the various upload paths doesn't seem to affect anything anyway.
    Are Fileupload Url, Upload Url Path, Upload Path supposed to show the "real" paths (blogs.dir...) or the clean ones?

    And yes, I removed those jpg files, that's why you get 404.

    You can use this post as reference:
    http://mycours.es/gamedesign2012/?p=1

    Redirects correctly to the clean url:
    http://mycours.es/gamedesign2012/hello-world/

    When I'm logged in I can see the image in the post. When I'm not, the image is a 400 error.

  10. Ah okay :)

    This works:

    http://mycours.es/gamedesign2012/wp-includes/ms-files.php?file=/2012/08/d.jpg

    It's your server not reading the .htaccess correctly. It can't translate this:
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    First make sure to turn off any caching plugins. If that doesn't help, point your host to this: http://codex.wordpress.org/Multisite_Network_Administration#Apache_Virtual_Hosts_and_Mod_Rewrite

    Tell them 'My more complex .htaccess rules are only being honored if I'm logged in to WP. This is usually indicative of apache mis-configurations. Can you check AllowOverride in my httpd.conf, and that it complies with the example here: http://codex.wordpress.org/Multisite_Network_Administration#Apache_Virtual_Hosts_and_Mod_Rewrite Thanks!'

  11. exploding
    Member
    Posted 2 years ago #

    Thank you Mika for the help.

    Just for future visitors: after a day of troubleshooting and calls I reached the #2 of domain.com's tech support whom doesn't know and has no way to know what their AllowOverride setting is. And in any case, they say, there would be no way to change it. Their httpd.conf is some sort of Necronomicon that nobody is allowed to read, let alone touch.

    But I suspect the problem is a missing AllowOverride FileInfo on virtual server configuration.

    I tried an install on my other host (MediaTemple) and of course works.

    So the moral is domain.com doesn't support WP multisite.

  12. Yeah, its them, which is horrible :(

  13. mt-Drew
    Member
    Posted 2 years ago #

    @exploding - Sorry to hear you're having issues but am glad things are working out for you at (mt) Media Temple. Let us know if we can help you out at all, we're @mediatemple on Twitter :).

    Drew J
    [ Signature moderated. ]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.