Wildcard DNS a me nā Subdomain Dynamic

I koʻu mau manawa kaʻawale (ha!), Ke hana nei wau e wahī i ka Palapala ʻāina Manu Manu Manu ʻole palapala noi me kahi noi ʻoihana e ʻae i nā poʻe e hoʻolālā i ko lākou hale kūʻai hale kūʻai ponoʻī. ʻO ka hoʻomohala ʻana i kaʻu polokalamu ponoʻī ma ke ʻano he lawelawe lawelawe ka pahuhopu o kaʻu no kekahi mau makahiki, a he manawa kūpono maikaʻi loa kēia.

Aia he mau hiʻohiʻona nui ʻelua ma waho o ka waihona aʻu i makemake ai e hoʻokomo i ka noi e lilo i pilikia nui loa no laila makemake wau e kūkākūkā iā lākou i ka hanana āu e ʻimi nei e hana like. Kūleʻa nā hiʻohiʻona ʻelua ma nā noi āpau, akā ua ʻike wau ʻoiai he mau maʻamau lākou, ʻaʻole kākoʻo nui nā mea lawelawe iā lākou!

ʻO kaʻu pahuhopu ke kūkulu ʻana i kahi noi lawelawe pilikino kahi e hiki ai i ka mea kūʻai aku ke hoʻonohonoho i kā lākou iho subdomain (http://subdomain.myapplicationdomain.com), a i ʻole hoʻopili i kā lākou iho subdomain (http://subdomain. kou aupuni.com). I mea e lilo ai ia i lawelawe nona iho, pono ia i ka hiki ke papahana i ka hopena - akā hiki i kekahi mau faila hoʻonohonoho kikowaena kikowaena inoa i palena ʻole ʻia me ka hapa nui o nā waihona e mālama ana. Kākoʻo ka pilikia no Wildcard DNS, ʻo ia hoʻi, e hiki ai ke kuhikuhi i kekahi subdomain i ke kikowaena o ke kikowaena. I nā huaʻōlelo ʻē aʻe, test.domain.com a i ʻole www.domain.com a i ʻole any.domain.com kuhikuhi nā mea āpau i ka wahi like. ʻAʻole mea āu e kākau ai - e holo pono ia.

Ma waho o nā noi, he hiʻohiʻona maikaʻi loa kēia i hiki ai - ʻoiai ma kāu blog. ʻAe ʻia kekahi e kākau kekahi. kou aupuni.com a lawe iā lākou i koudomain.com. E kahaha paha ʻoe i ka nui o nā loulou maikaʻi ʻole e kuhi ana i kāu blog a pūnaewele paha. Hiki ke ʻike ʻia kēlā hele kalepa inā ʻaʻole ʻike ke kanaka he kuhi hewa me ka loulou.

Hana ka hana ma ke kākau hou ʻana i ka subdomain i kahi querystring ma mua o ka hāʻawi ʻia ʻana o ka ʻaoʻao e ka pūnaewele pūnaewele ... no laila ua unuhi maoli ʻia ʻo subdomain.domain.com e nā kikowaena Apache ma ke ʻano he domain.com? He aha=subdomain ma o ka hoʻohana ʻana i kahi faile htaccess:

# Unuhi i ka ʻāpana subdomain o domain.com
RewriteCond% {HTTP_HOST} ^ ([^ \.] +) \. Yourdomain \ .com $ [NC]
 
# E hōʻoia i ka ʻaoʻao subdomain ʻaʻole www a me ftp a me ka leka uila
RewriteCond% 1! ^ (Www | ftp | leka uila) $ [NC]
 
# Hoʻokele i nā noi āpau i kahi script php e hele nei ma ke ʻano he hoʻopaʻapaʻa i ka subdomain
RewriteRule ^. * $ Http://www.yourdomain.com/%1 [R, L]

Aia kekahi mau ʻike hou aʻe ma nā faile e pono ai ʻoe e hoʻoponopono ma V-nessa.net. E hoʻomaopopo ʻaʻole i loaʻa nā faila ma kahi i kuhikuhi ʻia e pili ana i kāu mea lawelawe punaewele. Kākoʻo nui ka mea lawelawe pūnaewele i ka poʻe e ʻaʻa mai ana, akā ke aʻoaʻo nei lākou i ka hana ʻana pēlā e kāpae i ke kākoʻo mea kūʻai aku. A ʻo 'hack i kāu pilikia ponoʻī', ʻaʻole lākou e hele aku e kōkua iā ʻoe.

E hana wau i ka hoʻomohala ʻana i ke koena o ka noi ma mua o ke kau ʻia ʻana i ka hoʻomohala subdomain. E hāʻawi nō wau CakePHP kahi pana e hoʻohana ai ma ke ʻano he kumu no ia!

Kahakaha hope, he hack wau i kēia mea. Ua hoʻopōmaikaʻi ʻia au me nā kime hoʻolālā i kaʻu hana e wehewehe i kēia mea. Ma kaʻu iho, makaʻu iki wau. Hoʻomaikaʻi ʻia nā manaʻo a me nā kōkua!

3 Comments

  1. 1

    Hauʻoli loa. Ua hoʻohana maoli wau i ka inoa o kaʻu mea kākau inoa me wildcard DNS ʻoiai wau me SliceHost, a ua hoʻonohonoho ʻia ʻo Apache e lawelawe i nā subdomain hoʻonohonoho ʻole ʻia mai nā faila kikowaena maʻamau.

    Ua hoihoi wau i ka nānā ʻana i ka paehana CakePHP, akā ua make kāu loulou 🙂

    Hiki ke loaʻa ʻo CakePHP ma http://cakephp.ORG

    • 2

      E noʻonoʻo ana wau e pili ana i ka hele ʻana i ke ala hoʻopaʻa inoa hoʻi, e Alex. He manaʻo maikaʻi kēlā - ʻo ia paha ke ala ʻoi e lawelawe ai i kēia.

      E kala mai e pili ana i ka loulou make - ua hoʻopaʻa ʻia i kēia manawa.

  2. 3

    ua hoʻokele ʻoe e ʻike i kahi mea hāʻawi e ʻae iā ʻoe e hana i kēia? (koe wale nō ma ka hoʻolimalima ʻana i kahi kikowaena hoʻolaʻa)

Pehea kou manaʻo?

Ke hoʻohana nei kēia pūnaewele i ka Akismet e ho'ēmi i ka spam. E aʻo pehea e hanaʻia ai kāuʻikeʻikepili.