简体   繁体   中英

Domain Mapping To Subdomain

Im running SAAS where customer signs up and a script installation takes place in a subdomain, ie, subdomain.mydomain.com and starts using the site. Now I want to allow my customers to map their FULL domain eg. www.customerdomain.com to subdomain.mydomain.com, something like bloggers.com or wordpress does. How I can do this. I am using Linux dedicated server. Help would be greatly appreciated. I dont want URL masking or redirection.

I'm currently developing a project and have recently faced the exact same issue. Here's two ways you can go about solving it:

  1. Super-easy
  2. A little more tricky, but not impossible

The first would be to allow domain mapping of subdomains (eg http://subdomain.example.com ). This is dead simple for your users to setup. They would head over to their registrar and create a new CNAME record as follows:

(name) subdomain.example.com -> (record) subdomain.yoursite.com

Unlike changing A Records, this change only takes about 120 mins to fully propagate (compared with up to 72 hrs).

If your users pay for the privilege of using the domain mapping feature (ie it's not made available to users on a free plan), then you could could store each user's custom subdomain in your database, then check against this (in .php) when they try to access your website via their custom subdomain. If they're allowed, do nothing, otherwise redirect them to an alternate url.

So that's the easy one over and done with. Now for trickier option. If you have a dedicated IP address, or in your case a dedicated server, you can use the cPanel API to dynamically create A Records, this way users would be able to map their domain (rather just their subdomain) to your website. You would need to make the following A Record for your customer, together with getting them to update their domain's A Record with your dedicated IP address:

Your server: (name) customersdomain.com -> (record) subdomain.yoursite.com

Customer's registrar: www -> (record) [YOUR IP ADDRESS]

I'm not going to detail the API process for you, but you can read through the documentation here:

http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/ApiAuthentication

Anyways, I hope this helps and that you have fun building your website!

J

The (name) represents the custom domain belonging to your customer (eg customerdomain.com). The (record) would point to their subdomain on your SAAS site. So if I signed up to your website with a username of 'nike', you would use 'nike.yoursite.com'.

J

Install the wordpress domain mapping plugin , obviously your wordpress installation is setup for Wordpress MU.

Now the way I understand it you want to give your bloggers the opportunity to host their blog on their own personal domain while still hosting on your sever. Under "Domain Mapping" in "Settings" of "Network Administrator"(Super User).

There is Domain Options :

You want to check the User domain mapping page that's Option 3 .

This will allow your blog users to specify the domain of their personal site. One thing to remind them is that their DNS records should point to your web server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM