Take the 2-minute tour ×

I have media content on a hosted server that I want to be accessed by another domain.

In the configuration file, even if I "Allow from all," all hosts except itself will fetch the hosting company's generic landing page, which puzzles me.

I test it with curl, with the command:

curl -H "Host: anything.com" http://mydomain.com

and it just shows the hosting company's page.

If I do:

curl -H "Host: mydomain.com" http://mydomain.com

it will show my content.

How do I allow other hosts to access my content? I thought it would work with "Allow" in .htaccess, but it doesn't.

share|improve this question
add comment

4 Answers

Read up on http host headers. It's doing exactly what it should. You need to have your hosting company add another host header for your new domain.

share|improve this answer
ah, the Host: header is meant to tell the server what host you are looking for, instead of reading it from the URL, right? it's not in anyway like the referrer +1 –  cpbills May 18 '10 at 2:44
add comment

a few assumptions

running apache on a linux box

check the httpd.conf as there is a default config that limits the "Allow" to localhost, plus the default config does not enable overrides (.htaccess files)

share|improve this answer
add comment

is the domain name new? it sounds to me like the DNS records haven't quite propagated and example.com is still pointing to the hosting site's parked domain.

try doing dig example.com to see what information comes up, and if that is accurate. also, try going right to the ip address of your webhost.

as Mark pointed out, Host headers don't do what you think they do, you're telling your server that you want the page for anything.com not that you are browsing from anything.com

if you're still having problems browsing your site, i strongly suspect it's DNS 'propagation' issues.

share|improve this answer
add comment

On a Linux box? Check your /etc/hosts. The server has (probably) bound the listening address by hostname, which may (probably) be pointing at a 127.0.x.x address - try adding local entry by hostname for the real IPs of the machine and restarting the process.

Mark and cpbills are right that the Host header is probably causing you grief but this a good thing to check regardless as it can be a cause of the symptoms you describe.

share|improve this answer
add comment

Your Answer

