Ingcaciso eNtsha yesiGaba esiDala ngokuBuyela kuLwazi ngokutsha (Regex) kwi-WordPress

I-Regex-Amagqabantshintshi aQhelekileyo

Kwezi veki zimbalwa zidlulileyo, besinceda umthengi ukuba enze imfuduko enzima ngeWordPress. Umthengi uneemveliso ezimbini, zombini eziye zathandwa kangangokuba kuye kwafuneka ukuba bahlule amashishini, uphawu, kunye nomxholo ukwahlula imimandla. Ngumsebenzi omkhulu lowo!

Indawo yabo ekhoyo ihlala ihleli, kodwa idomeyini entsha iya kuba nayo yonke imixholo ngokubhekisele kuloo mveliso… ukusuka kwimifanekiso, iiposti, izifundo, ukhuphelo, iifom, isiseko solwazi, njl. Njl. Ungaphoswa yinto enye.

Nje ukuba indawo entsha isebenze kwaye isebenze, ixesha lokutsala iswitshi kwaye siyibeke bukhoma ifikile. Oko kwakuthetha ukuba naziphi na ii-URL ezivela kwindawo yokuqala eyayikule mveliso kwakufuneka zithunyelwe kwisizinda esitsha. Sigcine iindlela ezininzi zihambelana phakathi kweendawo, ke isitshixo sasicwangcisa ulungelelwaniso ngokufanelekileyo.

Phinda uthumele iiplagi kwiWordPress

Zimbini iiplagi ezidumileyo ezikhoyo ezenza umsebenzi omkhulu wokulawula ukuphinda usebenze nge-WordPress:

  • ukufumana enye indlela -Mhlawumbi eyona iplagi intle kwintengiso, kunye nokubonisa okuqhelekileyo kunye neendidi zokulawula ulungelelwaniso lwakho.
  • Isikhundla se-SEO -I-plugin ye-SEO engasindiyo ngumoya ophefumlayo kwaye yenza uluhlu lwam lwe Iiplagi ezigqwesileyo zeWordPress kwintengiso. Inokuphinda iqondise njengenxalenye yokunikezelwa kwayo kwaye iya kungenisa idatha yeRedirection ukuba ufudukela kuyo.

Ukuba usebenzisa i-Injini ye-WordPress ebanjelweyo njenge WPEngine, Banemodyuli yokuphatha ukuqondisa kwakhona ngaphambi kokuba umntu abethe indawo yakho… into entle enokunciphisa ukubambezeleka kunye nokuhamba phambili ekubanjweni kwakho.

Kwaye, ewe, unako bhala uthumele imigaqo kwifayile yakho .htaccess kwiseva yakho yeWordPress… kodwa andizukuyicebisa. Unempazamo enye yes syntax kude ekwenzeni indawo yakho ingafikeleleki!

Uyenza njani iRegex kwakhona

Kumzekelo endiwunike apha ngasentla, kunokubonakala kulula ukwenza nje ulungelelwaniso oluqhelekileyo ukusuka kwifolda eya kwisizinda esitsha kunye nefolder:

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

Kukho ingxaki ngalonto, nangona. Kuthekani ukuba usasazile amakhonkco kunye namaphulo anemibuzo yokulandela umkhankaso okanye ukuhambisa? La maphepha awayi kuphinda aqondise ngokufanelekileyo. Mhlawumbi i-URL yile:

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

Kuba ubhale ukungqinelana ngqo, loo URL ayizukuphinda iqondise naphi na! Ke, unokulingwa ukuba uyenze intetho eqhelekileyo kwaye ungeze ikhadi lasendle kwi-URL:

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

Kulungile, kodwa kusekho iingxaki ezimbalwa. Okokuqala, izakuthelekisa nayiphi na i-URL kunye / imveliso-a / kuyo kwaye ubadlulisele bonke kwindawo enye. Ke zonke ezi ndlela ziya kuthunyelwa kwindawo enye.

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

Amagqabantshintshi esiqhelo sisixhobo esihle, nangona. Okokuqala, unokuhlaziya umthombo wakho ukuqinisekisa ukuba inqanaba lefolda lichongiwe.

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

Oko kuyakuqinisekisa ukuba kuphela kwinqanaba elisezantsi lefolda eliya kuthumela ngokufanelekileyo. Ngoku kule ngxaki yesibini… uyakuyifumana njani le nto yokubuza umbuzo ufakwe kwisiza esitsha ukuba ukuqondisa kwakhona kungayibandakanyi? Ewe, amabinzana aqhelekileyo anesisombululo esihle saloo nto:

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

Ulwazi lwekhadi lasendle liyabanjwa kwaye lifakelwe indawo ngokusebenzisa indawo eyahlukileyo. Ke…

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

Ngaba uya kuthumela ngokufanelekileyo kwi:

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

Gcina ukhumbula ukuba ikhadi lasendle liya kwenza ukuba nayiphi na ifolda engaphantsi iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde iphinde ihambelane nelixa linakho ukwenziwa kwakhona:

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

Ndiza kuthumela kwi:

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

Ewe, amabinzana aqhelekileyo anokufumana ubunzima ngakumbi kunale ... kodwa bendifuna ukubonelela ngesampulu ekhawulezayo yendlela yokusetha i-wildcard regex eqondisa kwakhona ehambisa yonke into ngokucocekileyo kwidomeyini entsha!

Ingaba ucinga ntoni?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda indlela idatha yakho yokubhaliweyo isetyenziswe ngayo.