|Allowing others to use my domain as an alias|
A question about CNAME, I guess?
Hi. Hope some experts here can shed light on this. I would like to implement on my website the kind of functionality that FeedBurner has started offering.
For example, my RSS feed used to be:
But FeedBurner allows me to set a "CNAME" record and have this instead:
I would like to offer a similar service to my users. I am looking for guidance on how to do this. Read up the CNAME stuff I could find online (but most of it is about how to set it up, not how to *offer* it as a FeedBurner kind of provider).
I also found some useful threads on this forum: e.g., [webmasterworld.com...] - but they are dead and they don't exactly have all the info.
Let me illustrate with an example:
1. MYDOMAIN is my website.
2. MYUSER is someone who uses my site. Currently he accesses the webservice on my site as
3. He also owns a domain called HISDOMAIN.COM.
4. I would like him to have the same functionality as in Step 2 (on my site) when he types in:
5. On my website, I will ask him for HISDOMAIN.COM and in my database I will associate the user MYUSER with HISDOMAIN.COM.
Hope I have explained this clearly. Now my question: for enabling step 4, do I need to do anything special from my side? I suppose some RewriteRules etc would be in order so that I can take the HTTP_HOST and get "HISDOMAIN.COM" from it and then look it up in my database.
Would appreciate if someone could either offer some advice or point me in the direction of some article that covers this info. Thanks!
Come to think of it, I don't want to offer an open lumpsum "
http://MYDOMAIN.HISDOMAIN.COM/" type service because that would mean that anyone would just pass off my site as their own domain.
What I would like to do is that when that URL is typed, I check "HISDOMAIN.COM" in my DB and only allow functionality that is tied to MYUSER, otherwise show a polite error.
I haven't a clue what you're writing about:-(
Read up about FeedBurner MyBrand. As an example:
My RSS feeds used to be:
But with the above service, I can have my feeds at:
Because FeedBurner allows me to point feeds.mysite.com as a CNAME to feedburner.com.
My question: how does the feedburner side make this happen? What does their Apache look for?
When you move your MyBrand feeds over to your Google account you'll see that they now use a unique ID URL that you will point your CNAME to.
Yes, and how does Google/Feedburner make that happen? When an end-user who owns the feed points a CNAME on his domain to Google/Feedburner, how does it work from the Google side?
I am Google in this example, not the feed owner. As my original question suggests, I want to offer this functionality to my end users.
My question is: how should I ask my end users to set up CNAME to point to my website. What does my Apache on my end need to recognize different CNAME entries?
Thanks. I hope I am clearer this time.
All you really need is an IP-based VirtualHost. Then the scripts which produce the pages for that VirtualHost would use the HTTP Host: header to determine which user's content to send.
pinterface, thanks. I think I already know what you suggested as a general idea. It's the specifics that are frustrating. I already have my domains VirtualHost set up (that is how Apache serves up the website!).
Let me give an example, again:
My website is: TOPSERVICE.COM
My enduser's website is: USER.NET
I want TOPSERVICE.USER.NET to point to my server. So let's say that USER.NET on his domain has already set a CNAME to point to TOPSERVICE.COM.
So now in my Apache httpd.conf, what rules should I write? I doubt it will be ip-based. It has to be host name based. Right?
Well, first, if you request your-service.customers.vanity.domain, does your webserver respond to it with anything at all? If not, and the CNAME is pointing to the right place, you'll need to make sure your apache is configured to respond to all requests on that IP, not just specific hostnames.
Once apache is responding, you're pretty much done with httpd.conf. Now you make your page-serving scripts (PHP, Perl, whatever) check the Host: header (probably by the HTTP_HOST request variable) and serve up content based on that. E.g., look up the domain in a database to see which user owns it, and then serve up a page for that user. If no user owns the domain, serve up an error page.
1. Strictly speaking you could use name-based virtual hosting:
ServerAlias example.customer-1.com example.customer-2.com ...
But then you would have to reboot apache every time a customer added or changed their vanity domain. Ew.
The CNAME mapping does in fact point to something, but I am not sure what. Let me explain.
I have a dedicated hosting set up on server. Let's call it
dedicatedhosts.com. That's where the Apache is running. This is on IP 22.214.171.124 (masked here).
From this host server are running about twenty domains. Each of them has a
VirtualHost entry. The IP always remains the same for each of these domains: 126.96.36.199 (masked here, but you get the idea).
So each working website from my dedicated server looks like this in the httpd.conf file:
And so on.
Let's call the one I am interested in
mysite.com. This domain site is live and working. Since many years. With user IDs and all that.
Now I want to allow
mysite.userdomains.com as explained, where
userdomains.com is an end-user's website.
To test the CNAME functionality I took one of my own web domains, say,
myother.com as an example end-user's website and set a CNAME on it to point to
To my surprise, this "works": when I now try
mysite.myother.com it brings up a Cpanel default page. But this is not the index.php page on mysite.com or anything.
My question: where is this default Cpanel page coming from? How can I make the CNAME point to a particular page or program?
And your httpd.conf also has somewhere in it a
NameVirtualHost 188.8.131.52:80 or
You're getting the CPanel default page because that's the default page apache is set to serve when no corresponding VirtualHost is found. First, peruse Apache's documentation [httpd.apache.org], because CPanel is probably not going to help you (if my experience with cpanel is any indication, it'll actively work against you). Then you need to do one of two things:
- Change the default page apache serves from the cpanel one to the one intended to serve your vanity domain content
- Set up a second IP just for the vanity domains--and a corresponding DNS entry to which people can CNAME, something like userdomains.mysite.com--, and do IP-based VirtualHosting off of that.
|How can I make the CNAME point to a particular page or program? |
I think you might be confused about what, exactly, a CNAME does. A CNAME essentially says 'this domain has the same IP address as that other domain'. That's it.
Pinterface, this is very useful. Thank you so much! I will try those things now and let you know.