最近遇到一個案例是想讓每個會員都能擁有自己的子網域,比方說某個會員在這網站上建立了一個test321的帳號,那麼系統就會自動新增test321.diimii.com的子網域,並存放個人頁面與資料。

大部份的系統都是用某支程式來做會員的首頁,如
http://www.xx.com/user/index.php?id=1 或是
http://www.xx.com/user/index.php?account=test321
所以做法的重點,就是想辦法讓子網域去對應會員程式,如
http://test321.xx.com 對應
http://www.xx.com/user/index.php?account=test321
* 14400 IN A 207.210.64.5 //自己網站的IP
2a. APACHE的httpd.conf直接新增ServerAlias
ServerAlias *.diimii.com //自己網站的domain
2b. 如是用<VirtualHost>標籤在httpd.conf建立多個網站
<VirtualHost 207.210.64.5:80>
DocumentRoot /userdata/diimii/public_html
ServerAlias *.diimii.com
ServerName www.diimii.com
</VirtualHost>
註:2a或2b視情況擇一使用
建立動態子網域設定

完成

註2:接續看下篇子網域對應會員帳號的轉址程式及設定
在Google及Yahoo找資料,已成為許多人每天必行的公事。「網路」的無遠弗屆,造就了一個世界級的知識寶庫,著實讓我受益良多。
設立此部落格除用做網路行銷、學習記事與知識管理外,希望也能做些回饋和經驗分享,如果有人能從這裡的文章得到一點幫助就好了...
網站生日:2008/09/16 年紀:41個多月
米米
四月 16th, 2009 at 2:56 下午
感謝教學唷~~
我想請問一下
1. DNS新增A設定
是新增 cname 嘛?
(我測試server2003 DNS server 只能存 cname/新增主機的話不能輸入* )
ANDY
四月 16th, 2009 at 7:12 下午
server2003我沒有在用,所以不清楚你的問題,你可以試著在google找尋”windows server 2003 wildcard dns”這樣的詞彙,應該會有你需要的資訊…以下是我找到的操作步驟:
1. Open the DNS Console
2. Expand Forward Lookup Zones
3. Right click and add a new zone
4. Zone type is Primary (AD Integrated or not, doesn’t matter).
5. Name the zone . (just a dot on its own)
6. If using standard primary it will call the zone name root.dns (depending on the version of Windows)
7. Once the zone has been created select it
8. Right click and add a new Host (A) Record
9. Enter the name * (this is our Wildcard)
10. Enter the IP address you wish to send the name to (IP of the IIS server)
米米
四月 17th, 2009 at 10:14 上午
第一次玩DNS整個很鬼打牆
感謝您的回覆~
這關鍵字就是我要找的東西了~
感恩唷^^
我再試試看!