Nyowani Domain Yakajairika Kuratidzira (Regex) Inodzoreredza MuWordPress

Regex - Kugara Uchitaura

Kwemavhiki mashoma apfuura, isu tanga tichibatsira mutengi kuita chinetso chekutama neWordPress. Mutengi aive nezvigadzirwa zviviri, zvese zviri zviviri zvave kufarirwa kusvika pakufanira kupatsanura mabhizinesi, kushambadza, nezviri mukati kuti zvipatsanure madomeni. Ndiro basa chairo!

Domain yavo iripo irikugara, asi domaini nyowani ichave nezvose zvine chekuita nezvechigadzirwa icho ... kubva pamifananidzo, zvinyorwa, zvidzidzo zvemakesi, kurodha pasi, mafomu, hwaro hwezivo, nezvimwe. Takaita ongororo uye takakamba saiti kuti tione kuti ticha usarasikirwa nechero chinhu.

Pane imwe nguva isu tanga tine saiti nyowani munzvimbo uye mashandiro, iyo nguva yekudhonza switch uye kuiisa mhenyu yakanga yasvika. Izvi zvaireva kuti chero ma URL kubva kune yekutanga saiti yaive yechigadzirwa ichi aifanirwa kuendeswazve kunzvimbo nyowani. Isu takachengeta nzira zhinji dzinoenderana pakati pesaiti, saka kiyi yaive kumisikidza marongero acho nenzira kwayo.

Dzorerazve Plugins muShokoPress

Kune maviri akakurumbira plugins anowanikwa anoita basa rakakura rekugadzirisa redirects neWordPress:

  • Kudzorerwa - pamwe yakanakisa plugin pamusika, ine yakajairwa expression kugona uye kunyange zvikamu zvekutungamira zvako zvekutungamira.
  • Rankmath SEO - iyi isingaremi SEO plugin mweya wekufema mweya uye inoita yangu runyorwa rwe Akanakisa eWordPress plugins pamusika. Iyo inotungamira zvakare sechikamu chechipo chayo uye ichatotumira iyo Redirection dhata kana iwe ukatamira kwairi.

Kana iwe uri kushandisa Yakagadziriswa WordPress Injini yekufambisa senge WPEngine, vane module yekubata redirects munhu asati amborova saiti yako ... yakanaka yakanaka ficha iyo inogona kudzora latency uye pamusoro pekugamuchira kwako.

Uye, hongu, unogona nyora redirect mitemo mune yako .htaccess faira pane yako WordPress server… asi ini handidi kuikurudzira. Uri imwe syntax kukanganisa kure nekuita kuti yako saiti isvikike!

Maitiro Ekugadzira iyo Regex Redirect

Mumuenzaniso wandinopa pamusoro, zvingaite senge zvakapusa kungoita zvakajairwazve kubva mufafura kuenda kudomain nyowani uye subfolder:

Source: /product-a/
Destination: https://newdomain.com/product-a/

Pane dambudziko neizvozvo, zvakadaro. Ko kana iwe ukagovanisa zvinongedzo nemishandirapamwe ine querystring yekutsvaga kwemushandirapamwe kana kutumira? Iwo mapeji haazotungamire zvakanaka. Zvichida iyo URL iri:

https://existingdomain.com/product-a/?utm_source=newsletter

Nekuti iwe wakanyora chaiwo mutambo, iyo URL haizotungamire chero kupi! Nekudaro, iwe unogona kuyedzwa kuti chiite chirevo chenguva dzose uye wedzera kadhi rechikara kune iyo URL:

Source: /product-a/(.*)
Destination: https://newdomain.com/product-a/

Izvo zvakanaka, asi kuchine mamwe matambudziko. Kutanga, ichaenderana nechero URL ne / chigadzirwa-a / mairi uye wovaendesa vese kunzvimbo imwe chete. Saka dzese nzira idzi dzino dzosera kunzvimbo imwecheteyo.

https://existingdomain.com/product-a/
https://existingdomain.com/help/product-a/
https://existingdomain.com/category/parent/product-a/

Kugara uchitaura chishandiso chakanaka, hazvo. Kutanga, iwe unogona kugadzirisa yako sosi kuti uve nechokwadi chekuti dura refaira rinozivikanwa.

Source: ^/product-a/(.*)
Destination: https://newdomain.com/product-a/

Izvo zvichave nechokwadi chekuti chete yekutanga dura dhairekitori ichaendesa zvakare mushe. Zvino padambudziko repiri… iwe unozowana sei ruzivo rwekubvunza rwakatorwa pane ino saiti nyowani kana rako redirect risingasanganise iro? Zvakanaka, mataurirwo enguva dzose ane mhinduro hombe kune izvo zvakare:

Source: ^/product-a/(.*)
Destination: https://newdomain.com/product-a/$1

Ruzivo rwemusango kadhi rinotorwa uye rinowedzerwa kwairi kuenda uchishandisa musiyano. Saka…

https://existingdomain.com/product-a/?utm_source=newsletter

Tichadzorera zvakanaka ku:

https://newdomain.com/product-a/?utm_source=newsletter

Ramba uchifunga kuti kadhi rechikara rinoita kuti chero diki diki dzoendeswe zvakare, saka izvi zvichapihwa zvakare

https://existingdomain.com/product-a/features/?utm_source=newsletter

Tichadzosera ku:

https://newdomain.com/product-a/features/?utm_source=newsletter

Ehezve, mataurirwo enguva dzose anogona kuve akaomarara kupfuura aya… asi ini ndanga ndichingoda kupa inokurumidza sampuro yekuti ungamise sei wildcard regex redirect iyo inopfuura zvese zvakachena kune nyowani domeini!

Unofungei?

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