Custom domain name mapping to user profile.

百般思念 提交于 2019-11-29 22:48:24

问题


Currently, user profiles are in the format of website.com/username which is fine. However, some heavier users wish to use custom domain names. This is similar to Tumblr. Users are given a subdomain of username.tumblr.com but they are allowed to use an external domain which gets mapped to the subdomain. How do I go about this in PHP? Allowing users to use custom domain names?

Thanks so much in advance for the help!


回答1:


You can use the following examples:

Basic PHP:

How to let PHP to create subdomain automatically for each user?

CodeIgniter:

http://net.tutsplus.com/tutorials/php/basecamp-style-subdomains-with-codeigniter/

Zend Framework:

Query regarding subdomain redirection in Zend Framework

$routeitem = new Zend_Controller_Router_Route_Regex('(.*)',
                    array(1 => '', 'controller' => 'redir', 'action' => 'view'),
                    array(1 => 'hash'),
                    '%s'
    );

Drupal:

http://drupal.org/node/146344




回答2:


You're after wildcard DNS; http://en.wikipedia.org/wiki/Wildcard_DNS_record

Unless you have your own server (as in a dedicated or VPS server where you can configure apache) this won't usually be possible as shared hosts normally won't allow this.

Here is a good guide on how you could set it up.



来源:https://stackoverflow.com/questions/8515644/custom-domain-name-mapping-to-user-profile

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