Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

.htaccess help

Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
SpaceshipSpaceship
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Not sure if I follow what your asking but

why not just put a "index.html" into each directory?
 
0
Close
Can't you just set the permissions on the server
 
0
Close
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
Close
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
Close
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
Close
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
Close
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
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back