The MU forums have moved to WordPress.org

500 Internal Server Error with non-existent files, happens on most MU sites (7 posts)

  1. richs0914
    Member
    Posted 4 years ago #

    I have been having a problem when any bot, or human for that matter, types in a file location that does not exist.

    Instead of returning a 404 error, it creates an internal redirect which eventually stops at 10 (my limit on my server).

    If enough of these happen it eats up my memory and crashes my server.

    So after being told that it was a plugin or theme causing it, I tried everything. Until the last thing to try was to start with a new server, with Ubuntu Hardy, Apache 2, PHP 5 and MySQL 5, then put in a fresh install of WPMU 2.7.1, and use the default theme, and have no plugins what so ever.

    To my dismay...the internal redirect happened again when i searched for something that wasn't there, like...

    http://bp-dev.org/wp-cotent/plugins/bp-core/images/mystery-man.jpg

    or...

    http://www.flokka.com/wp-cotent/plugins/bp-core/images/mystery-man.jpg
    (i misspelled "wp-content" and the error came)

    I soon realized that it wasn't only my site...I could pretty much get a 500 internal server error by typing in a files that doesn't exist on a wordpress Mu blog set-up. And i'm sure if i clicked it enough times, would be able to bring down someones site by eating up their alloted ram on their server, or at least slowing it down.

    try it...

    http://(insert your mu site here)/wp-cotent/plugins/bp-core/images/mystery-man.jpg

    I noticed that buddypress.org and wordpress.com both return 404 errors, which is what it should be. But, of the 30 plus MU installs that I am in no way affiliated with get the same error, it got me to thinking that it might be something in the standard rewrite rules that is doing this.

    Now onto my question...

    How do I stop or solve this?

    Any help is appreciated.

  2. andrea_r
    Moderator
    Posted 4 years ago #

    Well, looks like an issue for everyone to try and sort out.

    It happens on general WPMU sites without BP, which is the first thing I checked.

    I also tested various non-existent filenames and got expected 404's. Typing in incorrect *directory* name gives the 500 error.

    So I tested that on a single WP install, and it gives a 404.

    Hrm.

  3. litchi
    Member
    Posted 4 years ago #

    Hi dear andrea_r,

    Have you got any update on this issue?

    It really makes my server crash one or two times one day....

    Thanks.

  4. litchi
    Member
    Posted 4 years ago #

    I have found that if the file name / directory name starts with wp- then it will be 500 error, let's say, if the url is

    http://ixiezi.com/wp-contents/

    then it will be 500 error

    but if the url is

    http://ixiezi.com/contents/

    then it will be a correct 404 page displayed,

    So my assumption is it's one error of redirect all the file/directory starts with wp-.

    still investigating.

  5. mlepisto
    Member
    Posted 4 years ago #

    Hi,

    I have been dealing with this too. Definitely something tied to the rewrites. Like in richs0914's case, I have tried disabling everything. I also run the multiple sites/domains setup that you described on buddypress forum that lead me to this.

    What seems to work at least at this moment is a hack to my htaccess file. (I'm no programmer, so I'm almost sure I messed soemthing up, maybe some smarter-than-me people can tell it does?)

    I just took:
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    And commented it to:
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    #RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    I can still get to everything I need to a and the missing files are actually 404'd.

    I would be interested in hearing other thoughts on what this line does in this context and why the sites seem to work just fine without it and clear up the redirect issue.

    In my case, I also have a few extra htaccess lines but I don't think they make much difference since I commented out all non-standard changes prior to trying to find a solution.

    Here's the other lines, they're at the top of the file:

    # non-www redirect
    RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
    RewriteRule (.*) http://www.%{HTTP_HOST} [R=301,L]

    #old upload directory redirect (migrating from non-mu)
    Redirect 301 /wp-content/uploads/ /files/

    Hope that helps someone and/or helps to find a resolution here as I haven't seen any posts that seem to mention that anyone found a true solution.

  6. marcosf
    Member
    Posted 4 years ago #

    mlepisto: Thanks!

    Commenting this out works for me, too. Still investigating what might break due to this being commented out though....

  7. marcosf
    Member
    Posted 4 years ago #

    I just found another solution which seems to be a better solution than just removing this rule. I'm sure it's in there for a reason...

    I change this block:
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]

    to:
    RewriteCond %{ENV:REDIRECT_STATUS} !^$ [OR]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]

    Adding the top line, did the trick for me and I got a 404 error page back (from Apache).

    Thoughts?

About this Topic

  • Started 4 years ago by richs0914
  • Latest reply from marcosf