Re: [問題] 客制化網址

看板java作者 (瘋人院院長)時間17年前 (2008/10/22 20:44), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
※ 引述《roga (凝視)》之銘言: : ※ 引述《plokijuh (瘋人院院長)》之銘言: : : 大致上是利用 rewrite + dns : : dns 設定 : : example.com. 86400 IN A 111.222.111.222 : : *.example.com. 86400 IN CNAME example.com. : 這個設定很必須 : apache 裡面的 : ServerAlias 也要設定。 : ServerName example.com : ServerAlias *.example.com : : 再用 rewrite : : 將 subdomain rewrite : : http://username.example.com/ : : 重寫至下列網址 : : http://example.com/post.php?user=username : : 我自己是沒實做過 : : 不過看來應該可行 : : 參考資料 : : http://30cmLP.tw/7mqsq9 : : google 搜尋關鍵字 "user name subdomain" : 倒是不用 rewrite 拉.. : 如果 Java 可以判斷鍵入的網址的話,那直接對字串拆解就知道了 : 一年多前我有用 php 實做過 http://topdn.net 所以說 利用 getServerName() 取得 url 再解析 subdomain 解出 username 之後再拿 username 去作對應的動作 所以這樣可以省掉 rewrite 的動作 應該是這樣吧 -- 鄉民的 30cmLP 縮址服務 http://30cmlp.tw/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.136.156.196
文章代碼(AID): #18_o0miu (java)
文章代碼(AID): #18_o0miu (java)