jonsjava Posted April 22, 2008 Share Posted April 22, 2008 But this is my first question on this forum ever (go check, if you don't believe me ) I never check any other forum, so I'm posting it here, praying that you will help me anyways. I need some cool .htaccess magic done. I'm betting it's simple, but I usually just write a php script for this, but this time, it won't do. and on to the question: I need an .htaccess file that will generate a 404 not found error if the client isn't coming from a certian IP address. I don't need/want it to *look* like a 404, but to *be* a 404. Please, don't move this, I beg you. I never check any other area on phpfreaks than PHP help, because I'm always helping, and don't want to miss a question I may be able to help in answering. (I need a life *sigh*) Link to comment https://forums.phpfreaks.com/topic/102369-solved-i-know-im-in-the-wrong-place/ Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 You can do it with PHP. $not_allowed = array(IPs here); if (in_array($not_allowed, $_SERVER['REMOTE_ADDR'])) //I think that's the right order. { header("HTTP/1.0 404 Not Found"); include("/var/www/html/site.domain.com/err/404.php"); exit(); } Include the 404 document as appropriate. That might not be your path, so change it. Link to comment https://forums.phpfreaks.com/topic/102369-solved-i-know-im-in-the-wrong-place/#findComment-524162 Share on other sites More sharing options...
jonsjava Posted April 22, 2008 Author Share Posted April 22, 2008 you friggin rock. never used that header before. sweet! Link to comment https://forums.phpfreaks.com/topic/102369-solved-i-know-im-in-the-wrong-place/#findComment-524166 Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 No problem. I had to use it once, and now I remember it. Link to comment https://forums.phpfreaks.com/topic/102369-solved-i-know-im-in-the-wrong-place/#findComment-524172 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.