Forum Moderators: phranque

Message Too Old, No Replies

I'm really in trouble here - .htaccess stopped working.

.htaccess trouble shooting, php script handling,

         

Michel Samuel

1:06 pm on Jan 17, 2007 (gmt 0)

10+ Year Member



Up until yesterday this worked for one of my sites.

I'm getting an "Internal Server Error" when I call up the site now.

This was designed to block out a specific country.

Can someone tell me where I'm going wrong or point me in the right direction?

I put this in my .htaccess file.

 

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
#

And I did that to handle this PHP script I put at the top of my .html pages.

<?php
function iptonumber($ip){
$ip=explode('.', $ip);
return $ip[0]*pow(256, 3)+$ip[1]*pow(256, 2)+$ip[2]*256+$ip[3];
}
$ips=unserialize('a:8366:{i:0;a:2:{s:5:"minip";s:8:"33996344";s:5:"maxip";s:8:"33996351";}i:1;a:2:*******and the rest of the entire range of IPs*****"minip";s:10:"3577603040";s:5:"maxip";s:10:"3577603055";}}');
foreach($ips as $ip){
if($number<=$ip['maxip'] and $number>=$ip['minip']){
echo "SERVER ERROR\n";
exit;
}
}
?>

[edited by: Michel_Samuel at 1:07 pm (utc) on Jan. 17, 2007]

jdMorgan

3:31 am on Jan 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're mixing Handlers and Types -- Two different things. So, you've disabled your server's ability to handle .html and .htm files in any way. See Apache mod_MIME and Apache core for the definitions of AddHandler, RemoveHandler, and AddType.

Jim