Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell drive driver drivers email error ethernet excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition problem router slow software sound trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
restricting access to folders on server in php


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
sudhakararaog's Avatar
Computer Specs
Member with 64 posts.
 
Join Date: Sep 2007
Experience: Intermediate
24-Mar-2008, 07:17 AM #1
restricting access to folders on server in php
i am using apache server and presently when i try accessing any folders of my website i am able to

browse the files ex = www.website.com/images which is a serious security risk as i am building a

forum website using php and mysql.

in the root directory i have created a .htaccess file and whenever someone access a file which is not

on the server i have created a user friendly message that the file does not exist instead of a 404

error message displayed by the browser.

similar to this how can i go about restricting users to browse all my folders in the toot directory.

if anyone accesses for ex = www.website.com/phpscripts an alert should appear asking them to enter a

username and password.

1. how can i do this using apache.
2. where do i write the username and password information and will this apply to all the folders in

the root directory or specific directories.

please advice.

thanks.
Sequal7's Avatar
Computer Specs
Distinguished Member with 2,369 posts.
 
Join Date: Apr 2001
Location: Around the corner!
Experience: Including today?
24-Mar-2008, 02:46 PM #2
You can create a .htaccess file and place it into the directory, add this to it;
Code:
AuthUserFile /full/path/to/.htpasswd
AuthName "Protected Area Login Required"
AuthType Basic
The full/path/to/ has to be changed to the full path to your folder.
You can use this tool to create the .htpasswd user name and password that are allowed access.
Copy and paste the values into your .htpasswd file and place the new .htpasswd and the .htaccess file into the folder you want protected.
__________________
Good Luck on your fix

My real hobby..JoyCo
My real Job..(Second Hobby) IAFF Local 1865
Like the sites? My hobby is the one that created them!
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,705 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
24-Mar-2008, 02:58 PM #3
Quote:
Originally Posted by Sequal7 View Post
You can use this tool to create the .htpasswd user name and password that are allowed access.
Sweet! Great link!

Peace...
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:54 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.