CodeIgniter Forums

Full Version: How do sites use other people sub domains to run their site through?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I had a service from a company where I set up a sub domain for my website, and their service ran on it. It was a social media writing service, where I charged people to use the service, and they used it on my website, but via a sub domain (something like SEO.mydomain.co.uk) and to all intents and purposes they thought it was my service.

For a site I am working on now, I have just had the idea that this would be a great thing to offer. But have no idea how to do it.

I set up a subdomain on another site, and tried to do it, but it just is not that simple. The very first link they click takes them to the real site, not the faked one.

Would I need a script (possibly a pre-controller hook) that changes the base_url and site_url based on the requesting domain, or something like that. Is that the way to go to achieve this? Are there issues with cookies, or CSRF problems? I am guessing there will be issues there too.

It is just an idea I am toying with but would love to get the experiment going. Right now it just does not work in anywhere near an acceptable way at all.

Any insights or suggestions or explanations would be very warmly welcomed.

Thank you in advance,

Paul.
(03-21-2016, 06:58 PM)PaulD Wrote: [ -> ]Hi,

I had a service from a company where I set up a sub domain for my website, and their service ran on it. It was a social media writing service, where I charged people to use the service, and they used it on my website, but via a sub domain (something like SEO.mydomain.co.uk) and to all intents and purposes they thought it was my service.

For a site I am working on now, I have just had the idea that this would be a great thing to offer. But have no idea how to do it.

I set up a subdomain on another site, and tried to do it, but it just is not that simple. The very first link they click takes them to the real site, not the faked one.

Would I need a script (possibly a pre-controller hook) that changes the base_url and site_url based on the requesting domain, or something like that. Is that the way to go to achieve this? Are there issues with cookies, or CSRF problems? I am guessing there will be issues there too.

It is just an idea I am toying with but would love to get the experiment going. Right now it just does not work in anywhere near an acceptable way at all.

Any insights or suggestions or explanations would be very warmly welcomed.

Thank you in advance,

Paul.

I'm not sure I understand your question, but I think you're looking for wildcard subdomains?

Nginx:
http://serverfault.com/questions/249952/...s-on-nginx

Apache: 
http://stackoverflow.com/questions/75835...-subdomain
Not sure I am but thanks for the lead.

Say ABC Ltd runs an online web app of some sort.

123 Ltd sets up a sub domain and points it to a particular url on ABC ltd, who do something (not sure what)

Then a customer of 123 ltd, goes to the section called 'Some service or other'on 123's website but is actually using the app provided by ABC ltd. The customer of 123 never knows about ABC ltd, but think they are on the website of 123 Ltd, as all the urls are for 123's website.

Does that make sense?
(03-22-2016, 10:03 AM)PaulD Wrote: [ -> ]Not sure I am but thanks for the lead.

Say ABC Ltd runs an online web app of some sort.

123 Ltd sets up a sub domain and points it to a particular url on ABC ltd, who do something (not sure what)

Then a customer of 123 ltd, goes to the section called 'Some service or other'on 123's website but is actually using the app provided by ABC ltd. The customer of 123 never knows about ABC ltd, but think they are on the website of 123 Ltd, as all the urls are for 123's website.

Does that make sense?

I think so. So you'd want to setup a wildcard subdomain under ABC LTD with the subdomain 123 LTD. The server serves content from ABC so custers from 123 get everything ABC has to offer
Thank you albertleao, you're a star!

I will have a look into that and learn a bit about these wildcards and see what I can do with them.

Thank you, sorry for doubting you (or misunderstanding) previously.

Best wishes,

Paul.
(03-22-2016, 12:35 PM)PaulD Wrote: [ -> ]Thank you albertleao, you're a star!

I will have a look into that and learn a bit about these wildcards and see what I can do with them.

Thank you, sorry for doubting you (or misunderstanding) previously.

Best wishes,

Paul.

It's fine, glad I could help. I've played around with wildcards but I've never implemented wildcard subdomains in a production environment so please let me know how it goes.