WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multisite image upload/link problem (19 posts)

  1. Fothery
    Member
    Posted 3 years ago #

    Hi,

    I installed 3.2.1 as a multisite with sub domains a week or so ago at heartofthe.net. All seemed to work okay ie I had sorted out wildcard domains etc..

    But, on messing about with a sub blog paul.heartofthe.net I appear to be having image upload and display problems.

    When I upload an image eg from within a new blog post, the image gets uploaded correctly to (it is blog number 4) wp-content/blogs.dir/4/files but the URL inserted into the post by WordPress doesnt work and therefore the image isnt displayed.

    So, the image exists at:

    http://heartofthe.net/wp-content/blogs.dir/4/files/2011/08/toxel.jpg

    But should also be found by multisite via:

    http://paul.heartofthe.net/files/2011/08/toxel.jpg

    I have read Image upload problems for multisite subdomain site which is essentially the same problem from what I can see.

    Based on this previous thread, I have confirmed with my web host that AllowOverride is set to ALL and my .htaccess looks okay too. It's exactly the same as the .htaccess specified inside the Admin dashboard under Network Setup:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]

    Any ideas where I might be going wrong...?

    Any help much appreciated.

  2. Normally this means your htaccess file isn't being read. Check your httpd.conf file and make sure that 'AllowOverride' is set to all.

  3. Fothery
    Member
    Posted 3 years ago #

    Thanks for the quick reply!

    Having read the previous thread regarding a similar problem, I have confirmed with my web host that AllowOverride is set to All.

    So I guess it must be something else...

  4. Sometimes it needs to be AllowOverride File Options.

  5. Fothery
    Member
    Posted 3 years ago #

    Update: Just tested whether heartofthe.net's .htaccess was being read by uploading an .htaccess with the word "test" in it, which crashed the site/server, so it is being read. Put the old .htaccess back as above and we're back to as before. Very strange...

  6. Putting an .htaccess up with invalid code will cause an error 500 :)

  7. torralaq
    Member
    Posted 3 years ago #

    I'm having the same issue with WPMS on IIS7. I did modify the web.config based on another thread, changing the reference to blogs.php to ms-files.php but this did not fix the problem for me. Other than that, the problem is completely identical to what has been posted in this thread and several others that I've seen. I haven't seen any suggestions for IIS however. What can I try? Thanks :)

  8. Fothery
    Member
    Posted 3 years ago #

    Hi Andrea-r,

    Thanks for the suggestion, but my web host has said that:

    Hello,

    There is no File directive for AllowOverRide directive:

    Apache AllowOverRide

    And the tech jargon on that page has me completely lost :)

    With me testing above that the .htaccess is being checked, I found a suggestion on another thread to enclose all the .htaccess text above in <IfModule mod_rewrite.c> ....... </IfModule> and that made no difference, so I have reverted to above again.

    I have checked if ms-files.php exists and it does and it looks like a lot of lovely complex php ending with:

    // If we made it this far, just serve the file
    readfile( $file );
    ?>

    Is it possible/worth checking where in ms-files.php I'm being kicked out? Or do we feel that the WordPress files are highly unlikely to need any alteration (ie there's thousands of installations with no problems) and this is essentially an .htaccess or AllowOverride problem still? Or something else?

    Could I try something different in the .htaccess that could steer me in the right direction to resolve this issue?

    Thanks for your continued patience and assistance.

  9. Yeah, I mis typed that one. ;)

    Its still an htaccess issue as, like you said, thousands (hundreds of thousands) of install are fine.

  10. torralaq
    Member
    Posted 3 years ago #

    It's not wordpress code that is to blame. You just have to find the right configuration for your .htaccess and apache config that will work for you. My problems were solved by modifying the web.config.....it is now working. I have no idea why, I don't know enough about the rewrite rules to completely understand what they are doing, but I mangled rules from suggestions here and there and it finally works. For anyone interested:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  11. torralaq - That's only applicable if you're using Windows servers. Linux (and Apache) use .htaccess instead of web.config, and the one provided by WP is a standard version that works out of the box for most servers.

    If it's not working, it's the server, NOT the .htaccess.

  12. Fothery
    Member
    Posted 3 years ago #

    Thanks all for your continued help and points in the right direction. It's still not working but I'm "trying" hard!

    ... yeah, "trying" everyone's patience!

  13. Fothery
    Member
    Posted 3 years ago #

    Ok, I think Ive found the problem.

    I have a main domain on my hosting account that is also running a complex php script (not WordPress). The multisite is working as an add-on domain in a sub folder/directory.

    ie /public_html/ this is the main domain's directory that it's non WordPress script works out of.

    and my multisite runs in /public_html/anotherdomain2/

    Since my main domain is also running a php script it has a quite complex .htaccess file and when I delete it, the main domain of course doesnt work, but... the multisite is back, images show correctly and all is good! Yay!

    But, when I put the .htaccess file for the main domain back (to get that working), we are back to the same.

    So, I guess there is a conflict with the 2 .htaccess files...?

    The main domain: /public_html/.htaccess
    The multisite domain (and multisite subdomains) /public_html/anotherdomain2/.htaccess

    In my research over the last few days I see that subsequent .htaccess files in sub directories overwrite previous rules, non overwritten rules can still apply and sometimes if there are similar rules and if a previous rule fits better then Apache applies that (I think I got that right, but probably not).

    So... the million dollar question. Is there a command for .htaccess that I can put in the multisite .htaccess that says ignore all previous rules from the main domain .htaccess???

    Or is there another way? Could I use explicit full URLs in the multisite .htaccess that would trick the server into running those rules because they fit better?

    eg Im sure this wont work, but you'll get the idea of what I mean:

    # uploaded files
    RewriteRule http://*.heartofthe.net/files/(.+) wp-includes/ms-files.php?file=$1 [L]

    As always, any help very much appreciated. Thanks in advance.

  14. Depending on what the content is of public_html/.htaccess, yes, it cuold be affecting subfolders.

  15. Fothery
    Member
    Posted 3 years ago #

    Update: My friendly webhost (Arvixe.com) have sorted my .htaccess conflicts out and it looks like we're up and running correctly.

    Thanks everyone for your help and direction.

  16. mujie
    Member
    Posted 2 years ago #

    @Fothery : Hi, I have similiar problem with you. Can you give a few lines of your htaccess trick please ? Thanks.

  17. mujie
    Member
    Posted 2 years ago #

    UPDATE : problem solved, I found this at htaccess main root, and disabled it. Its work likes charm now :-)

    # Protect directories
    <Files ~ "^(backup|files|images|include|lang|libs(/.+)?|temp(/.+)?|templates(/.+)?|javascripts(/.+)?)$">
      Order deny,allow
      Deny from all
    </Files>
  18. mujie - Next time make a new post for yourself ;) If a post is marked resolved, we assume no one needs anymore help.

  19. mujie
    Member
    Posted 2 years ago #

    @Ipstenu : my apoligies, I just curious how Fothery resolving his problem, because its looks similiar with my problem. Nice thread :-)

Topic Closed

This topic has been closed to new replies.

About this Topic