Restricting domains from web directory
-
I have my site hosted on a hosting company's servers. I have a directory in that site, let's call it www.mysite.com/safe/notsafe/ I'd like to restrict access to the "notsafe" directory. Ideally, I'd like to only permit web access if the requesting browser comes from one of a list of permissable domain names (namely, my work and my home). I know one can restrict an ENTIRE site's traffic by using .htaccess in the root directory, but (a) I don't think I can use htaccess to restrict certain directories (I may be wrong here).... (b) I'm never quite sure if htaccess should reside in the root of my publicly-accessible web root or its parent.... (c) I tried muddling with htaccess and accidentally wiped out my FrontPage extensions. Is there a way I can restrict access to one directory to only certain accessing domains?
-
Answer:
Hi jhabley-ga, Good day and thanks for your question. To answer (a), you can use htaccess to restrict directories, even webpages. First determine which IP addresses you wish to grant or deny access to. IP address can be in either numberic format or by hostname. Next create a file called .htaccess in the directory that you wish to limit access to. This access restriction will affect all files and subdirectories under this directory. In the file .htacess, add the following lines: <limit get post> order deny allow deny from xxx.xxx.xxx.xxx allow from xxx.xxx.xxx.xxx </limit> If you want to block access to your pages from a particular IP, then add the line deny from xxx.xxx.xxx.xxx, replacing xxx.xxx.xxx.xxx with the actual IP address. If you want to grant access to a certain IP address then you would add the line allow from xxx.xxx.xxx.xxx, replacing xxx.xxx.xxx.xx with the actual IP address for each IP address. Order is important here! All lines starting with DENY must come before any line starting with ALLOW. It is possible to use "wildcards" when specify IP addresses. For example, .edu will match any machine whose hostname ends with .edu. While 128.8. will match any machine whose IP address starts with 128.8 I hope this answered your question. If you have any clarifications, please don't hesitate to ask. Thank you for using this service and have a nice day Regards, aditya2k.
jhabley-ga at Google Answers Visit the source
Related Q & A:
- How To Get TLD Domains Free?Best solution by 1and1.com
- How To Build Business Directory Using Php Mysql?Best solution by Stack Overflow
- Where can I get the cheapest .us domains?Best solution by namecheap.com
- What's with youtube restricting videos lately?Best solution by Yahoo! Answers
- Multiple domains for similar content?Best solution by networksolutions.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.