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.

The company I work for hosts SaaS websites. The problem is that some clients want to host these websites themselves. The primary reason for this is that they want to upload other applications and data to their websites that we do not currently support.

Transferring our software to the clients host is time consuming, causes problems depending on the hosting environment and really isn't a great thing as we are giving away the core system on which the company is based.

Can a .htaccess file be made which will allow a webpage to load in the web browser and appear like it is hosted by the client.

To clarify. I have two domains. mysite.sites.com and mydomain.com. Is there a way to make the content of mysite.sites.com appear on mydomain.com using .htaccess (Can't change domain pointers for the reason above)

If this is possible could you give a sample or link to a relevant resource which shows how this can be done.

share|improve this question

2 Answers 2

You can use mod_proxy's interface to mod_rewrite on mydomain.com to make the server reverse-proxy content from mysite.sites.com

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

e.g.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ http://mysite.sites.com/$0 [L,P]

This will serve any existing file or directory on the server, so they can upload files and serve other content, whilst proxying non-existant urls from your servers.

share|improve this answer
    
This looks very promising. I will look further into it. –  JasonS Dec 9 '10 at 6:28

You don't say what web server software you're running, but, most servers support vhosts.

With Apache, create a vhost

ServerName www.mydomain.com ServerAlias mysite.sites.com DocumentRoot /usr/www/mydomain.com

That vhost will respond on the IPADDRESS to requests to www.mydomain.com and mysite.sites.com as long as the DNS on those two records points at your IPADDRESS it will be transparent to the user.

You must ensure your application references the HTTP_HOST header requested and doesn't use hard-links to www.mydomain.com

Does this make sense?

Andrew

share|improve this answer
    
"The primary reason for this is that they want to upload other applications and data to their websites that we do not currently support." You soln would require him to support that. –  Mark Wagner Dec 3 '10 at 18:05

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.