• Resolved Fothery

    (@fothery)


    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.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

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

    Thread Starter Fothery

    (@fothery)

    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…

    Sometimes it needs to be AllowOverride File Options.

    Thread Starter Fothery

    (@fothery)

    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…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Putting an .htaccess up with invalid code will cause an error 500 🙂

    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 🙂

    Thread Starter Fothery

    (@fothery)

    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.

    Yeah, I mis typed that one. 😉

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

    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]

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    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.

    Thread Starter Fothery

    (@fothery)

    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!

    Thread Starter Fothery

    (@fothery)

    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.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

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

    Thread Starter Fothery

    (@fothery)

    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.

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

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Multisite image upload/link problem’ is closed to new replies.