Help .htaccess Server error

Tag: .htaccess Author: aesop2006 Date: 2009-08-07

i added this code to .htaccess and place it the root of my website: $allowed[0]=""; $allowed[1]="yyy.yyy.yyy.yyy";

// add as many as you need

if (!in_array($_SERVER['REMOTE_ADDR'],$allowed)) header("HTTP/1.1 403 Forbidden");


but it's seems it doesn't work, I'm getting server error page

can you please tell me what i did wrong?

Thank you

Other Answer1

Get rid of it. That's PHP code, .htaccess is for Apache code/syntax. I think you want something like:

<Limit GET POST>
Order Deny,Allow
Deny from All
Allow from

Specify the IPs that you want, assuming this is some sort of restricted area.


Why would you only want to limit GET and POST?
That's just the first thing that popped in my head as it's the syntax I have used thus far. Would you not rely on the Limit directive and just have the Order/Deny/Allow straight up in the .htaccess or does it need to be contained in some directive?