| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Sep 2005 Location: Montreal
Posts: 1,401
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | .htaccess help Hi there, I don't know if this has been asked before. I could not find a relavant post. This is what I want to do. I have a site mysite.com and I have a directory loocated at mysite.com/dir/ And other files on my site use lot of files from this directory calling items as mysite.com/dir/item1 and mysite.com/dir/item2 like that. This calling is done by php script and those results will be shown on the site. Now how can I restrict anybody's access directly to mysite.com/dir/ Their purpose could be to download all the items one by one. I tried some code for .htaccess but it stopped complet access meaning my site could not show anything. So in essense what I am looking for is help to protect a directory from direct access but at the same time my server or my site can access it. ????: NamePros.com http://www.namepros.com/code/134257-htaccess-help.html I will offer 25NP if anybody can help me with this, please. Thanks in advance, Gameshouse |
| |
| | #2 (permalink) |
| NamePros Regular Join Date: Jun 2004 Location: Iowa City
Posts: 703
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Not sure if I follow what your asking but why not just put a "index.html" into each directory?
__________________ formally ninedogger ------ Want to talk to a stranger? -->| Click Here | TalkToAStranger.com | <-- Meet New Friends |
| |
| | #3 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | Can't you just set the permissions on the server
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
| | THREAD STARTER #4 (permalink) |
| Senior Member Join Date: Sep 2005 Location: Montreal
Posts: 1,401
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Okay, let me try to be more clear. I want to deny direct access to a directory on my site but at the same time let my site itself access the contents of that directory. In otherwords, I want to forbid access to this directory for outsiders (but my site must be able to use the contents of this directory though) How can I do that server permissions, I am little new in this. Do you mean CHMOD? the what should I have, it is right now 0777 Please explain Thanks, gamehouse
Last edited by gamehouse; 10-23-2005 at 10:50 AM.
|
| |
| | #5 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | Yeah, CHMOD. Try changing the permissions of the directory to 700. However, I'm unsure whether you will be able to include the files still. Try it and see
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
| | THREAD STARTER #6 (permalink) |
| Senior Member Join Date: Sep 2005 Location: Montreal
Posts: 1,401
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Okay, thanks I am going to try that. I just read on sitepoints that 744 is if the directory contents are html or files that dont require excution. I will try all the options when there are not clients on my site. Otherwise, I may loose them and will post the result here. 700 sounds a bit extreme, then again I am not the master in this. Thanks for hinting me about CHMOD, if it works, I will send you 25NP. Thanks, gamehouse |
| |
| | #7 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 579
![]() ![]() | don't for one second think that I'm the master. lol. If you're worried about it affecting clients. Run a test script. Create a new PHP file with the includes and save it in the same folder as the other PHP files. Good luck
__________________ SQL Dumpster - SQL Database Dumps and Resources |
| |
| | THREAD STARTER #8 (permalink) |
| Senior Member Join Date: Sep 2005 Location: Montreal
Posts: 1,401
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Okay I did it. In facT before I saw your reply, I did as following. I created a file and took all permissions off and put that in the directory where I want to deny direct access. Voila, it worked, all other files untouched, the directory denies access since it has a file with no access given. What do you think of that solution? Worth keeping it and enjoying the effect? Thanks Gamehouse |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using mod_rewrite and a .htaccess to do some redirection... 25 NP$ REWARD | mholt | Programming | 0 | 09-21-2005 02:15 PM |
| .htaccess: Prevent users from seeing private directories! | i386 | CODE | 1 | 07-27-2005 01:13 AM |
| .htaccess - help with relative path? | TeviH | Programming | 4 | 07-24-2005 03:51 PM |
| .htaccess + Domain Parking | wistow | Programming | 15 | 07-04-2005 08:46 AM |
| .htaccess | D@Z | Web Design Discussion | 5 | 04-27-2005 08:27 PM |