Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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
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

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

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

Your Answer


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