Unstoppable Domains

.htaccess help

Spaceship Spaceship
Watch
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.

I will offer 25NP if anybody can help me with this, please.

Thanks in advance,

Gameshouse
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Not sure if I follow what your asking but

why not just put a "index.html" into each directory?
 
0
•••
Can't you just set the permissions on the server
 
0
•••
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:
0
•••
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
 
0
•••
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
 
0
•••
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
 
0
•••
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
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back