Wildcard DNS uye Dynamic Subdomains

Munguva yangu yese yekusarudzika (ha!), Ndanga ndichishanda kuputira iyo Shiri Dzesango Mepu Isingagumi kunyorera nechishandiso chebhizimusi chinobvumira vanhu kuti vagadzire yavo pachavo chitoro locator. Kugadzira yangu Software seSevhisi mhinduro yanga iri chinangwa changu kwemakore akati wandei, uye uyu mukana wakanaka.

Pane zvinhu zviviri zvakakosha pasherufu izvo zvandaida kuisa mukushandisa izvo zviri kuve dambudziko hombe saka ndaida kuzvikurukura muchiitiko chaunenge uchitsvaga kuita zvakafanana. Ose maviri maficha akajairika munzvimbo dzese dzekushandisa, asi ini ndauya kuzoona kuti kunyangwe zviri nzvimbo dzakajairika, vazhinji vanopa vanogamuchira havanyatso kuvatsigira!

Chinangwa changu ndechekuvaka yega-sevhisi kunyorera uko mutengi anogona kumisikidza yavo yega subdomain (http://subdomain.myapplicationdomain.com), kana kushandisa yavo yavo subdomain (http://subdomain.yourdomain.com). Kuti ive yekuzvishandira-yega, inoda kugona kuronga mhinduro - asi inowana rimwe zita rezita dhata server yekumisikidza mafaira ayo ari pamiganhu neruzhinji rwekugamuchira maakaundi! Iyo nyaya ndeye rutsigiro rweWardcard DNS, ndiko kuti, kugona kunongedza chero subdomain kune dura revhavha. Mune mamwe mazwi, test.domain.com kana www.domain.com kana any.domain.com zvese zvinongedzera kunzvimbo imwechete. Zvisinei nezvaunonyora - zvinoshanda.

Kunze kwekushandisa, ichi chinhu chakanakisa kuve chakabvumidzwa - kunyangwe pane yako blog. Izvo zvaizotendera chero munhu kunyora chinhu.yourdomain.com uye uuye navo ku yakodomain.com. Iwe unogona kushamisika kuti mangani ma link akashata aripo anonongedzera kublog rako kana webhusaiti. Izvo zvinogona kupotsa traffic kana munhu wacho asingazive kuti iko kukanganisa neiyi link.

Maitiro acho anoshanda nekunyorazve iyo subdomain kune querystring peji risati ranyatso kushandurwa ne webserver… saka subdomain.domain.com inonyatso kududzirwa nemaseva eApache se domain.com?what=subdomain kuburikidza nekushandisa htaccess faira:

# Bvisa iyo subdomain chikamu chedomain.com
NyorazveCond% {HTTP_HOST} ^ ([^ ^.] +) \ .Domain yako. .Com $ [NC]
 
# Tarisa kuti iyo subdomain chikamu hachisi www uye ftp uye tsamba
NyorazveCond% 1! ^ (Www | ftp | tsamba) $ [NC]
 
# Dzoreredza zvese zvikumbiro kune php script inopfuura sekupokana iyo subdomain
NyorazveRule ^. * $ Http://www.yourdomain.com/%1 [R, L]

Pane rumwe ruzivo rwekuwedzera pane iwo mafaera iwe aunofanirwa kugadzirisa pa V-nessa.net. Ziva kuti mafaera anogona kunge asiri kuwanikwa pane zvakatsanangurwa zvichienderana neako wekutambira mupi. Wangu wekutambira mupi anonyanya kutsigira vanhu kupindira, asi ivo vanoyambira kuti kuita kudaro kunogona kushayisa rutsigiro rwevatengi. Zvakare uye 'kubira panjodzi yako wega', ivo havasi kuzosvika pakubatsira iwe, chero.

Ndiri kuzoshanda mukuvandudza kunze kwekusara kwekushandisa pane kusungirirwa pane subdomain budiriro. Ndiri kuzopa CakePHP pfuti yekushandisa seyakagadzika yacho!

Yekupedzisira noti, ini ndiri wekubiridzira pane izvi zvinhu. Ini ndakakomborerwa nezvikwata zvekuvandudza pabasa rangu kuti ndione zvinhu izvi kunze. Ndiri ndega, ndiri nenjodzi. Chero mhinduro uye rubatsiro zvinokosheswa!

3 Comments

  1. 1

    Very cool. Ini chaizvo ndakashandisa zita reregistrar's name server ne wildcard DNS pandakanga ndiine SliceHost, uye ndaiva neApache yakagadziridzwa kuti ishumire isina kurongeka subdomain kubva kune akajairwa madomasi mafaera.

    Ndakanakidzwa chaizvo kutarisa iyo CakePHP chimiro, asi chinongedzo chako chakafa 🙂

    CakePHP inogona kuwanikwa pa http://cakephp.ORG

    • 2

      Ini ndanga ndichifunga nezvekuenda nenzira yekunyoreswa zvakare, Alex. Iro izano rakanaka - pamwe ndiyo nzira yakanakisa yekubata iyi.

      Tine urombo nezve yakafa link - yagadziriswa izvozvi.

  2. 3

Unofungei?

Nzvimbo iyi inoshandisa Akismet kuderedza spam. Dzidza kuti sei deta yako inoshandiswa.