Working of Domain and sub-domain names of websites - web-services

How do sub-domain names work?
Actually I want to develop platform for CVs and I bought a domain www.cv.com. Now I want the url for each user with his/her name like www.john.cv.com or www.cv.john.com.
Does single domain work for this case or do I have to buy the sub-domains too? How is it managed programmatically?

www.john.cv.com will work. Will you have to buy or not depends on your domain name provider and packages. In maximum cases atmost 5 sub domain is free if you need further you have to pay certain price.

Related

Is there a way to know if an user owns a domain?

I'm developing a webapp(Django) that let users have an eshop just with a few clicks. I serve the shops under https://shopname.mydomain.es but then I give them the option to use a domain if they want.
For example one of my users (user1) buys "happyuser.com" in a domain provider of his choice. Then I tell them to modify their DNS to point to my server. So far so good, everything works perfectly, I use Nginx to allow access from the connected domains and everything works correctly.
Here comes my doubt. I use a middleware to detect the host, in this case "happyuser.com", I check a table in which I have the relation between user and domain name.
class UserDomain(models.Model):
user = ForeingKey(...)
domain = UrlField(...)
Then I tell Django to serve the correct shop. But what happens if another user (user2) also saves the domain "happyuser.com", how can I know which user shop should I load?. I know is unlikely that this happens, but is there a way to prevent this problem?
You need some form of activation process for the domain before you officially associate it with that user account. For example:
Ask the user to store a particular value (generated randomly for that user) in a DNS TXT record, or set a particular random CNAME subdomain (e.g. ijiqjwv87123rbbv8123.happyuser.com) to point to your domain. Then query that DNS record and see if it's as expected.
Ask the user to set up the DNS records as necessary to point to your server, then make an HTTP request to that custom domain and a specific path (e.g. happyuser.com/check) and expect to receive some specific token from your own server.
Both ways prove that the user has deliberately configured the domain, over which they apparently have control, according to instructions you gave only to them, proving that they must be the owner of the domain for all intents and purposes.
I think you're right, it's a very unlikely issue. There is not much point spending a lot of time on it. Ensure that table with customer domains have unique index on that column, stops the issue form happening and takes few moments to implement.

How to forward my domain registered with AWS Route53 to Google My Business?

My domain: fishercoder.com is registered with AWS Route53.
Now I'd like to configure Google My Business to use this domain.
I searched on Google's doc and found that they do offer clear instructions on how to purchase a new domain through them, for third-party domain they listed instructions for GoDaddy, eNom and Network Solutions, but none for AWS Route53.
I thought it might be similar, so I tried to simulate what I can do on AWS Route 53 console, but didn't find any luck.
Any could share any ideas how to achieve this?
More details:
Right now, when people search "fisher coder", this page shows up: https://ibb.co/pRWjRc9, and if they click Website, it'll take them to the default Google My Business website which is not what I desired, I'd like to change it to point to my own domain: fishercoder.com
Thanks!
You can do it but it’s not a pretty solution. Not only that but a Google My Business Site (I assume this is what you mean) is so basic it’s not a good website replacement at all. It’s a good free option to set up because it’s free but other than that, it’s meant to keep people in Google, not to help you. You can only map custom domain buy from from business sites option given there.
Here’s how you do it:
Buy a domain wherever you prefer (I like Namecheap but Google Domains is also a good option).
Forward the domain to the Google Sites URL (many registrars will allow you to do this for free).
That’s it!
It’s not a pretty solution nor ideal because the URL of the Google Site will still be the original URL and they won’t stay on your custom domain at all.
So, simple description: if someone types in http://customdomain.com they will get forwarded to your Google URL and remain on that URL. It essentially just forwards to your Google Site, that’s it.
In AWS routes you will get option to forward domain. https://aws.amazon.com/premiumsupport/knowledge-center/redirect-domain-route-53/
This all information based on own experiment and study based on below link
Reference info : https://www.quora.com/How-can-I-attach-a-custom-domain-to-a-Google-Sites-website

What are best practices for sub-domain-based accounts in Django?

The use case is pretty straight forward SaaS:
each account gets a sub-domain
each account has multiple users, with multiple roles
Most of my searches turn up apps/packages from 2007-2009, and I am not sure that what I find is still relevant.
For me this simple snippet is enought to get account name from subdomain: http://djangosnippets.org/snippets/1119/, there is also a newer middleware: https://github.com/tkaemming/django-subdomains. In django database you could use this domain name as a prefix for username and keep all of them in django standard auth_user table (just add/cut this prefix during authentication or when you want to dispaly this name).
What problems do you have with these snippets?
The only problem from my point of view is automatic setup of subdomains, but it depends on your hosting, does it has these API or not.

What's a reasonable instance where this regex might not catch a webmail referrer in Google Analytics?

^mail\.(.*)?|(.*)?(web|\.)mail(.*)? is the exact regex I'm looking to scrutinize.
For example,
e3.mail.yahoo.com
webmail.example.com
hotmail.com
mail.aol.com
etc.
To be totally honest, its a fruitless effort, especially because even if you do manage to somehow do a re-write of all of the email domains that referred people to your site, there are 3 reasons it won't work:
You can't possibly account for all of the email domains out there.
If the email is hosted on HTTPS, and your pages are HTTP, you won't see a referrer anyways.
A very significant portion of the email using population uses non-web mail, like Outlook, Entourage, Mac Mail, iPhone Mail, Blackberry Mail, Android Gmail, to name a few, that never have a referrer.
Instead, if you're looking to segment the referrals of all of email referrals for tracking in Google Analytics, you should use utm variables in your URLs.
If you tag your URLs with utm_source and utm_medium, you'll be able to track them, regardless of the 3 restrictions listed above.
Traditionally, you'd set utm_medium to be email, and utm_source to be the mailing list name, and utm_campaign for the name of the specific campaign.
You can get assistance in building the URLs here: http://www.google.com/support/analytics/bin/answer.py?answer=55578
Even if links in email messages should be tagged with utm_xxx parameters, I like to clean and group my referral sources into clusters as much as possible. It is the way to go to understand effectively the sources of traffic that are missing proper tagging, and then prioritize and fix them.
The regex I use is the following, and honestly it works pretty well (it catches more than 95% of webmails that show up as referrals and can be split over dozens of subdomains like for yahoo or live, thus diluting their visibility as a source)
(messag|courrier|zimbra|imp|mail)(.*)\.(.*)\..{2,4}
You may update the subdomain names with values frequent in your area. The end catches any domain using a tld of 2-4 chars, and any domain.
I output the result as
Output To -> Constructor : Campaign Source : Webmail - $A3

How do I allow users to map their domains to a url on my site?

How do I allow users to map their domains to a url on my site? (like how tumblr or blogger does)
The app is being developed in Django. I want the users to be able to map their domains to mydomain.com/username (is this possible or do I need to have a format like username.mydomain.com?)
Also my app runs on a VPS so I have my nameservers as ns1.mydomain.com and ns2.mydomain.com.
easiest way is through domain cloaking. most domain name providers will allow users this option.
another easy idea is to provide your users with a very generic html page that just includes their url on your site in an iframe and have them places that as their default directory index (e.g. index.html).
both the aforementioned would always show the base domain (without trickery). as noted below, a CNAME DNS record would take care of this, assuming they have the ability to edit DNS records...
www.someuserdomain.com. CNAME username.yoursite.com
In that case, you will have to consult your specific hosting setup for how to programmatically change your DNS settings. Whether you can actually do this depends on the host. If your server is running a DNS server that you have access to, you can probably change it that way.