All php pages give Internal Server Error

Hey guys.

Since it’s a friday, I can’t ask my host about this, but apparently, all the .php pages on my websites are giving out the “Internal Server Error”… this started just now, I was not on my admin cp, I did 0 changes to my website today, in fact, I changed nothing for about a week now.

I host a few forums and got alerted by some users just now who were browsing and suddenly this happens.

The website in question:
cudamine.com

Full Error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, xxx@email.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I use cPanel X.

Should I be worried about this? Some sort of attack or something? All HTML pages work fine, it’s just .php that seems to have this issue, is this a problem on my hosts end, or can I do anything about this before monday? Thanks guys, and sorry if this is the wrong place to ask. It’s just that I don’t want to have no site for the whole weekend…

EDIT:
After reading up on the web about similar situations, I found some info on the .htaccess file, I found the file and this is what’s in it:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^cudamine.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.cudamine.com$
RewriteRule ^santa\\-maria\\/forum\\/?(.*)$ "http\\:\\/\\/cudamine\\.com\\/santa\\-maria\\/\\?page_id\\=7\\/$1" [R=301,L]

Those two RewriteCond are 2 of my links that use php… I tried deleting this file, nothing changed though.

Do you have any new errors showing in php’s error log?

Cuda,

500 errors are normally from a syntax error in an .htaccess file so let me go directly to your .htaccess code:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^cudamine.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.cudamine.com$
RewriteRule ^santa\\-maria\\/forum\\/?(.*)$ "http\\:\\/\\/cudamine\\.com\\/santa\\-maria\\/\\?page_id\\=7\\/$1" [R=301,L]

On the surface, there are a LOT of errors but only one looks like a loop which should send Apache spinning out of control. Line by line:

RewriteEngine on - perfect! That merely ensures that mod_rewrite is not in comment mode but is ready to go (IF mod_rewrite is enabled - view your phpinfo() from cPanel or, if you can, run the simple test in my signature’s tutorial).

RewriteCond %{HTTP_HOST} ^cudamine.com$ [OR] - not right but not damaging as the dot character SHOULD be escaped (to ensure that it will only match a dot character)

RewriteCond %{HTTP_HOST} ^www.cudamine.com$ - ditto

Please note that these two RewriteCond statements should have been combined into one: RewriteCond %{HTTP_HOST} ^(www\.)cudamine\.com [NC]. The NC is the No Case flag which should always be used with examining the {HTTP_HOST} variable.

RewriteRule ^santa\-maria\/forum\/?(.*)$ “http\:\/\/cudamine\.com\/santa\-maria\/\?page_id\=7\/$1” [R=301,L] - while omitting the escape characters in the RewriteCond statements, you’ve gone overboard escaping everything (none of which should be escaped)! In addition, quotes should not be used - especially with the redirection. This should have been:

RewriteRule ^santa-maria/forum/(.*)$ http://cudamine.com/santa-maria/?page_id=7/$1 [R=301,L]

Of course, it LOOKS like you might have been attempting to match a query string with the atom you created but, because the RewriteRule can ONLY examine the {REQUEST_URI} variable, that is doomed immediately to abject failure (I don’t understand why people don’t use the filenames rather than trust Apache to fetch the correct DirectoryIndex file, too!).

Because the only effect of the RewriteCond statements is to ensure it’s your cudamine domain that’s being redirected, the only effect of your mod_rewrite code is to convert santa-maria/forum/{garbage} to santa-maria/{directory_index}?page_id=7/{garbage} AND to display the redirection (useful for testing but rarely used on a production server).

In summary, it looks like the /? is an error (optional / before {garbage}) but that would not cause a 500 error. I suspect that Apache just decided it didn’t like everything escaped and gave up.

If you need a place to start (with coding examples) learning about mod_rewrite, try the tutorial linked in my signature.

Regards,

DK