marm Posted June 21, 2007 Share Posted June 21, 2007 Hello, I'm trying to prevent malicious users from knowing that I am using a php.ini file in my site. I have placed these lines in .htaccess but when you fetch headers on that file, it returns a 302 error. How can I send a 404 error instead of 302 ? <Files ~ "\.(ini)$"> order allow,deny deny from all </Files> Link to comment https://forums.phpfreaks.com/topic/56612-try-to-get-a-404-error-when-accessing-phpini/ Share on other sites More sharing options...
marm Posted June 21, 2007 Author Share Posted June 21, 2007 I mean to say 403 NOT 302. Link to comment https://forums.phpfreaks.com/topic/56612-try-to-get-a-404-error-when-accessing-phpini/#findComment-279618 Share on other sites More sharing options...
steviewdr Posted June 22, 2007 Share Posted June 22, 2007 Using a php.ini file in your website? I dont fully understand. Can you not place the php.ini in a NON web accessible folder? Here are the apache error codes: http://wiki.kartbuilding.net/index.php/Apache#Apache_Error_Codes 403 means forbidden, which by your <Files> restriction code, seems correct. -steve Link to comment https://forums.phpfreaks.com/topic/56612-try-to-get-a-404-error-when-accessing-phpini/#findComment-280444 Share on other sites More sharing options...
marm Posted June 23, 2007 Author Share Posted June 23, 2007 That's true for php.ini but what if I would like to do the same for .htaccess ? Link to comment https://forums.phpfreaks.com/topic/56612-try-to-get-a-404-error-when-accessing-phpini/#findComment-280787 Share on other sites More sharing options...
steviewdr Posted June 25, 2007 Share Posted June 25, 2007 Apache prevents viewing of .htaccess files by default. -steve Link to comment https://forums.phpfreaks.com/topic/56612-try-to-get-a-404-error-when-accessing-phpini/#findComment-281883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.