0

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.

2 Answers 2

1

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.

1
  • This looks very promising. I will look further into it.
    – JasonS
    Dec 9, 2010 at 6:28
-1

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

1
  • "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. Dec 3, 2010 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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