有没有一种方法可以创建动态####,这样当有人使用####.example.com访问我的网站时,URL将是去哪里的关键。
我知道Elance是用用户名做的,而不是www.elance.com它的username.elance.com
发布于 2010-02-02 02:52:06
如果你正在使用apache,在你的htaccess中有类似这样的东西,你的“动态子域”应该可以工作:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.yourDomain.com
RewriteCond %{HTTP_HOST} ([^.]+)\.yourDomain.com
RewriteRule ^(.*)$ /public_html/profile.php?userid=%1然后,当您编写http://KPheasey.yourDomain.com时,此请求将由带有userid get参数(值= KPheasey)的profile.php处理。
如果您使用的是IIS,则可以找到类似的here
https://stackoverflow.com/questions/2178174
复制相似问题