I'd like to make a download folder on my Server that's accessible via http://download.domain.com/ and host files like file.txt there.

This works with a URL frame, but they have to be includable via javascript (This doesn't seem to work when using a frame). Also if I just visit download.domain.com without specifying a file I use the index.php file to redirect back to domain.com

How can I make file.txt reachable via download.domain.com/file.txt and don't show the real path in the address bar. Also if I get redirected to domain.com from the download.domain.com URL how can I show the real address in the addressbar (This doesn't seem to work when using a frame either).

I'm a bit lost since this is my first server with an actual toplevel domain and all this frame/ redirect/ a address stuff still is a bit confusing.

Thank you in advance for your answer.

  • "make file.txt reachable via download.domain.com/file.txt and don't show the real path" - what's the "real path" that you don't want to show? From what you describe, can't you simply make the files available from download.domain.com?
    – MrWhite
    Sep 18, 2015 at 20:19

1 Answer 1


There are two basic ways that most domain name providers will use to set up a host name for a web site:

  • Point it at their own server and put a page there which contains only a frame pointing at another URL. This is awful.
  • Point it at an IP address. This is how it should be done.

Once the host name is pointing at the right IP address you need to have a HTTP server running on the computer with that address. (That is simplifying things a little, you can involve proxies along the way).

When a browser makes a request for the URL, it will look up the IP address from the domain and and then make an HTTP request which will include the hostname, path and query segments of the URL.

A very basic configuration of a web server will ignore the host part and only care about the path part.

You need to make sure you pay attention to the host part so you can serve up different content based on the hostname.

How you do this will depend on the HTTP server software you use.

The normal way to do this in Apache HTTPD is to configure a Virtual Name Host and give it a different DocumentRoot to the other site.

Cheap hosting might not give you that level of configuration, but might let you use mod_rewrite to change the path internally based on a variety of factors that include the host name.

Of course, you might be using some other HTTP server entirely. You'll need to investigate what options your host provides.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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