Sabon Bayyanar Yanayi Na Yau da kullun (Regex) Canza madogara A cikin WordPress

Regex - Maganganu na yau da kullun

A 'yan makonnin da suka gabata, mun kasance muna taimaka wa abokin harka don yin rikitarwa tare da WordPress. Abokin ciniki yana da samfuran guda biyu, dukansu biyu sun zama sananne har zuwa cewa dole ne su raba kasuwancin, alamar kasuwanci, da abubuwan da ke ciki don raba yankuna. Aiki ne abin yi!

Yankinsu na yanzu yana nan a sanya, amma sabon yankin zai sami dukkan abubuwanda suka shafi wannan samfurin… daga hotuna, rubuce-rubuce, nazarin harka, saukarwa, siffofin, tushen ilimi, da dai sauransu. 'karka rasa kadara daya.

Da zarar mun sami sabon rukunin yanar gizo kuma muna aiki, lokacin da za mu ja abin kunnawa mu saka shi da rai ya zo. Wannan yana nufin cewa duk URL da aka samo daga shafin farko wanda yake mallakar wannan samfurin dole ne a tura shi zuwa sabon yankin. Mun kiyaye yawancin hanyoyi daidai a tsakanin rukunin yanar gizon, don haka maɓallan ke saita hanyoyin da suka dace yadda ya kamata.

Canza madogara Plugins a cikin WordPress

Akwai shahararrun shahararrun plugins guda biyu waɗanda ke aiki mai girma don gudanar da turawa tare da WordPress:

  • Sauya madosa - wataƙila mafi kyawun plugin a kasuwa, tare da ikon faɗakarwa na yau da kullun har ma da rukuni don gudanar da sauyawa wuri.
  • Matsayi SEO - wannan SEO mara nauyi mai sauƙi shine iska mai kyau kuma yana sanya jerin na Mafi kyawun Plugins a kasuwa. Yana da turawa a matsayin wani ɓangare na miƙawar sa kuma zai ma shigo da bayanan Canza wuri idan kayi ƙaura zuwa gare shi.

Idan kana amfani da Managed WordPress Hosting engine kamar WPEngine, suna da wata hanya da zata iya amfani da hanyar turawa kafin mutum ya taba shafinka… kyakkyawa mai kyau wanda zai iya rage latency da kuma wuce gona da iri a yayin gudanar da aikin ka.

Kuma, tabbas, zaku iya rubuta ƙa'idojin turawa zuwa cikin fayil ɗin .htaccess a kan sabar WordPress… amma ba zan ba da shawarar ba. Kuskuren kuskure ne kawai yake samarwa shafin yanar gizo hanyar shiga!

Yadda Ake Kirkirar Sauyin Regex

A cikin misalin da na bayar a sama, yana iya zama mai sauƙi kawai don kawai yin saurin turawa daga ƙaramin fayil zuwa sabon yanki da ƙaramin fayil:

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

Akwai matsala tare da wannan, kodayake. Me za ku yi idan kun rarraba hanyoyin haɗin gwiwa da kamfen ɗin da ke da alaƙa don bin hanyar yaƙin neman zaɓe ko miƙawa fa? Waɗannan shafuka ba za su sake juyawa yadda ya kamata ba. Wataƙila URL ɗin shine:

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

Saboda kun rubuta daidai wasa, URL ɗin ba zai karkata ko'ina ba! Don haka, ƙila za a jarabce ku da sanya shi magana ta yau da kullun kuma ƙara alama zuwa URL ɗin:

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

Hakan yana da kyau, amma har yanzu akwai wasu matsaloli. Na farko, zai dace da kowane URL tare da / samfurin-a / a ciki kuma ka tura su duka wuri guda. Don haka duk waɗannan hanyoyi zasu karkata zuwa wuri guda.

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

Maganganu na yau da kullun kayan aiki ne masu kyau, kodayake. Da farko, zaku iya sabunta tushenku don tabbatar da cewa an gano matakin babban fayil.

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

Wannan zai tabbatar da cewa matakin babban fayil kawai zai sake turawa yadda yakamata. Yanzu don matsala ta biyu… ta yaya zaku sami bayanan sirrin da aka kama akan sabon rukunin yanar gizon idan turawa ba ya haɗa da shi? Da kyau, maganganu na yau da kullun suna da babbar mafita ga wannan kuma:

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

Hakikanin gaskiya an kama bayanan mahaɗan kuma an haɗa su ta hanyar amfani da m. Don haka…

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

Zai sake turawa zuwa:

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

Ka tuna cewa katin ƙwaƙwalwar zai ba da damar ƙaramin ƙaramin fayil shi ma, saboda haka wannan ma za a kunna:

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

Za a tura zuwa:

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

Tabbas, maganganu na yau da kullun zasu iya zama mafi rikitarwa fiye da wannan… amma kawai ina so ne in samar da samfurin hanzari na yadda za'a saita rediyo mai jujjuyawar jujjuyawar da zata wuce komai cikin tsafta zuwa sabon yanki!

Me kuke tunani?

Wannan shafin yana amfani da Akismet don rage spam. Koyi yadda aka sarrafa bayanan bayaninka.