Now I have another folder and I want to pretect this folder too...
...I want to restric access to a folder so when someone tries to access to this folder or any file on the folder gets the 403 error.
) BTW, there is no chmod in Windows, this is used in Linux only.
Here's more on .htaccess
to do this job you want done.
Create a .htaccess file in your text editor and add this line at the top:Deny from all
Then save the .htaccess file in the folder you want to protect with a 403 Access denied!
(You may have save file problems in Vista, so open Notepad by right clicking on the notepad.exe file and select to run as an administrator. Then under the File menu in your Notepad you can select Save as .htaccess
If you want to deny access from all but allow access to some, then you could add lines like these:Order deny,allow
Deny from all
Allow from 127.0.0.1
The above will allow access to localhost (or 127.0.0.1
) which is the PC that XAMPP is installed on, which in turn will allow you as the developer of your pages on your XAMPP to access the folder as normal but denies access to everyone else giving them a 403 Access denied!
If you wish, you can add others that you want to have access by adding their IP, if you know it, to the entry like so:Order deny,allow
Deny from all
Allow from 127.0.0.1 192.168.0.2
Allow from 18.104.22.168
Allow from myfriendsdomain.com
It is also possible to add partial IP address in the form Allow from 192.168.
which will allow all on the 192.168.0.0 LAN with IPs starting 192.168. to access.
The .htaccess is very powerful and quite flexible in this regard and a web search for .htaccess
will give many more helpful examples in the search results - this site for example:http://www.evolt.org/ultimate_htaccess_examples