Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to setup a website so that it only accepts requests from one particular domain / subfolder?

If so, how is this done?

share|improve this question

migrated from stackoverflow.com Feb 16 '10 at 5:42

This question came from our site for professional and enthusiast programmers.

    
-1 for poor question title. I'll vote back up if you edit the title so that it is more descriptive and therefore might match searches for this topic. –  Seth Petry-Johnson Feb 16 '10 at 1:22
2  
The question itself isn't so hot. How do you accept a request from a subfolder? –  Ignacio Vazquez-Abrams Feb 16 '10 at 1:23
    
Which platform and technology are you using? –  cxfx Feb 16 '10 at 1:25
add comment

2 Answers

Yes. You would just look at the CGI variable REMOTE_ADDR. Or, are you talking about the Referer? If you mean the latter, keep in mind it can be forged.

share|improve this answer
    
I think REMOTE_ADDR can be forged too, can't it? –  Scott Stafford Feb 16 '10 at 1:24
    
No. An HTTP GET requires an fully open TCP/IP connection, which requires two-way communication. –  Matthew Flaschen Feb 16 '10 at 1:35
add comment

If you are using apache you could setup access using .htaccess files in the folder you want to restrict. Or you could modify the .conf files and set up restrictions there.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.