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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 11:45:57

问题


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.


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/968173/how-do-i-allow-users-to-map-their-domains-to-a-url-on-my-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!