Background
I have a web application that I host on my own server. I have clients who use the application as is, but some have asked if they can ‘host’ the application on their own server. This enables them to have their own URLS rather than mine. The application only forms part of their website so I’m assuming it will not be possible for my server to respond to a direct call to their domain etc
To give some examples, i currently have urls like www.mydomain.com/profile, www.mydomain.com/index.php?option=someoption&view=someview&id=1 What my clients’ want is www.theirdomian.com/profile, www.theirdomian.com/index.php?option=someoption&view=someview&id=1 etc
Question
My question is, what is the best way for me to allow them to use their own URLs with my application, without giving them all the backend source code and databases to install on their server?
I dont really want to allow them to ‘host’ my application. But do want to enable them to use their own URLs, without having to modify anything on my server.
One way I thought would be to create a router.php file that sits on their server. When a link is clicked on the clients site, the router receives the request and modifies the url to get the data from my server etc. The route them outputs the html source back to the clients site via the calling URL.
Is this an effective way to achieve what I want, or is it way off the mark.
First of all, the links in your site should not be hardcoded. If you have hardcoded
www.mydomain.com/...everywhere… good luck getting it out of there. You should use URLs relative to the server root, e.g.:For even more flexibility, use a helper that creates URLs relative to where the app is being run from instead of hardcoding any URLs. If that’s done, all you need to do to access the same site using a different domain name is to configure the web server so it accepts requests for the domain name and setup the DNS entry for
theirdomain.comto point to your server.If that’s not an option, the guys running
theirdomain.comshould run a reverse proxy that serves your domain under their domain.