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

If so, how is this done?

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

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.

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy