Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a website hosted at www.example.com and a client that wants to point a subdomain of his to our website.

i.e. if someone visits subdomain.foo.com, then this automatically points to www.example.com/foo

This shouldn't be done via a redirect - i.e we want a visitor to subdomain.foo.com to remain on that url, even if they navigate further into the site.

I'm not sure if this is even possible.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

Your search term is "reverse proxy".

This will need to be configured on the web server of the client.

An Apache configuration would look something like:

<VirtualHost subdomain.foo.com:80>
ServerName subdomain.foo.com
ProxyPass        / http://www.example.com/foo
ProxyPassReverse / http://www.example.com/foo
</VirtualHost>

An nginx configuration would look something like:

server {
  server_name subdomain.foo.com;
  location / {
    proxy_pass http://www.example.com/foo ;
  }
}

Of course, what you wind up with will be determined by the client's server software, plus whatever would need to be done with those configuration options, including other directives to pass HTTP headers along, etc.

share|improve this answer
add comment

I'm pretty sure what you want can be achieved with a reverse proxy setup. For example, Apache uses mod_proxy to achieve this.

There are also many sites on the web that explain in detail how to set up a reverse proxy. I just can't really recommend a specific one.

share|improve this answer
add comment

Your Answer

 
discard

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.