Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

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

I'm building a website for public use.

It's a sharing website - everyone is allowed to download specific content, but I want to make sure nobody knows where all the files are kept, so I've decided to use URL Forwarding, e.g. when someone visits fakesite.com, it returns realsite.com without revealing/redirecting to realsite.com.

I don't know how to make this work. Please help me by explaining how to use URL Forwarding.

share|improve this question

It sounds to me like your problem is user permissions. It doesn't matter if a user knows where a "file is kept" as long as they can't download it when they shouldn't.

What you need to do is first store the files outside of the web root - for example if your site root is in /var/www/website, store the files in /var/websitefiles. Then on the site link to something like yoursite.com/download.php?file=123 which runs a script/program that gets the file from that websitefiles folder and serves it to the user. The download script can then check user permissions and deny the visitor access if they shouldn't have it.

share|improve this answer
Nice! This will definitely come in handy :) – Nick Jul 11 '12 at 19:30

Generally, we use proxies (reverse proxies) for this, or we just make the server listen on two domain names. If you don't own the domain you're linking to, you probably aren't allowed to proxy their site through your domain. This sounds to me like a warez or similar site, with which I want nothing to do with.

If you really want to go ahead with the reverse proxy, see another answer of mine: Point sub directory to another IP?

Just instead of using the IP, use your other domain name, and rather than make an Alias to a subfolder, make the entire VirtualHost listen for your public domain.

share|improve this answer
It's not warez, that's for sure! – Nick Jul 10 '12 at 14:55

Most servers will allow you to restrict access to the folder itself as not to show all the files inside of the directory. You could throw up an index.html which would prevent it too and then encrypt the name of the file (like vWorker does). That way even if someone knows all the files, they still can't get to them.

If you just want to hide the domain name you could use a CNAME in your DNS and point it to the other domain. If you don't have control over this Amazon Route53 makes it real easy.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.