protecting inc files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CraniumDesigns
Forum Newbie
Posts: 18
Joined: Fri Nov 07, 2003 1:35 am

protecting inc files

Post by CraniumDesigns »

how do i make it so that people can not just type in the address of my inc file and see all my account info? do i have to create an htaccess file? please help ASAP.
KofRad
Forum Newbie
Posts: 3
Joined: Wed Jan 07, 2004 12:01 am
Location: South Florida, USA
Contact:

Post by KofRad »

You can edit your apache httpd.conf file to have PHP parse those files as php, change the extension of your *.inc files to *.php, or you can place them out of the webroot. I dont know about .htaccess though as I never used it.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Code: Select all

<Files ~ "^.inc">
  ForceType application/x-httpd-php
</Files>
or better yet

Code: Select all

<Files ~ "^.inc">
  Order allow,deny 
  Deny from all
</Files>
http://httpd.apache.org/docs-2.0/mod/core.html#files
Post Reply