Hi,

I built a homepage. Some folders/pages should be no-accessible to visitors. Could someone show me a simple php script to do this.

Thanks.

phpnovice :lol:

Also I find this handy if I want to completely block users from viewing the contents of a folder; just put deny from all in a .htaccess file to block all users! :) This is great for a folder that contains include files that are included by other scripts but are never seen directly :)

Also I find this handy if I want to completely block users from viewing the contents of a folder; just put deny from all in a .htaccess file to block all users! :) This is great for a folder that contains include files that are included by other scripts but are never seen directly :)

Hi Gary,

Thanks for your help. I tried .htaccess, but it did not work. Once I set it up, I could not access mysql. Any attempt was refused by mysql. I tried different php code, and none of them worked. Then I switched my apache server to abyss server. Now I can easily access mysql. The problem is that abyss appears not support .htaccess. It will be greatly appreciated if you would help me set this protection up.

Thank you very much.

phpnovice

With .htaccess a little trick learned is to use:

IndexIgnore *.php

You can use things other than php but basically this hides all files from being seen in a directory if they have a .php extension. You can still open them however, so this should only really be used to hide rather than to block.

Interesting, thanks YoungCoder ;) If I had the time, I would look through the whole Apache doc to learn more things - but sadly, I don't :p

Interesting, thanks YoungCoder ;) If I had the time, I would look through the whole Apache doc to learn more things - but sadly, I don't :p

That would acctually make quite a nice bedtime read! So when you goto bed after a hard day coding, and are ready to unwind, you can have a nice thorough read! I have done similar before and have acctually dreamt about programming!

That would acctually make quite a nice bedtime read! So when you goto bed after a hard day coding, and are ready to unwind, you can have a nice thorough read! I have done similar before and have acctually dreamt about programming!

Nice, it must be very fancy if you display your programming dream on web. I can not because I can only spend a little time each day on this.

Thanks for your help.

pnpnovice

This article has been dead for over six months. Start a new discussion instead.