restricting access to folders on server

This is a discussion on "restricting access to folders on server" within the PHP Forum section. This forum, and the thread "restricting access to folders on server are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 24th, 2008, 10:36
Junior Member
Join Date: Dec 2007
Location: auckland
Age: 33
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
restricting access to folders on server

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.
Reply With Quote

  #2 (permalink)  
Old Mar 24th, 2008, 11:34
Reputable Member
Join Date: Nov 2007
Location: India
Posts: 150
Blog Entries: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: restricting access to folders on server

Use .htaccess or disable directory viewing from your Cpanel.
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
Reply With Quote
  #3 (permalink)  
Old Mar 24th, 2008, 13:14
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,012
Blog Entries: 2
Thanks: 5
Thanked 23 Times in 20 Posts
Send a message via Skype™ to Aso
Re: restricting access to folders on server

Following on from Rohan, this article on .htaccess password protection should help you out
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Reply With Quote
  #4 (permalink)  
Old Mar 30th, 2008, 18:48
Junior Member
Join Date: Oct 2007
Location: UK
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Re: restricting access to folders on server

I have set up a password protected directory following those instructions, but how can I access files inside that directory using PHP?

Edit: Never mind, I was trying to access an image file inside the folder and seems this is not possible.

Last edited by djeyewater; Mar 30th, 2008 at 19:01. Reason: Found answer
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How do I access my web server from the command line? MikeHopley Other Programming Languages 5 Jan 18th, 2008 15:35
Making the form Secure & Restricting Chars PicoDeath PHP Forum 3 Aug 2nd, 2007 20:00
How do you made folders that are... simonb Webforumz Cafe 9 Jul 25th, 2007 21:12
Passwords - restricting access to the webpage or parts of it pengyou Starting Out 5 May 24th, 2007 11:38


All times are GMT. The time now is 20:51.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43