Muujinta Joogtada ah ee Domainka (Regex) Tilmaamaha WordPress

Regex - Muujinta Joogtada ah

Toddobaadyadii la soo dhaafay, waxaan ka caawinaynay macmiil inuu ku sameeyo guurguur adag WordPress. Macmiilku wuxuu lahaa laba shey, oo labaduba caan ku noqday ilaa heer ay ahayd inay kala qeybsadaan meheradaha, astaamaynta, iyo waxyaabaha ay ka kooban tahay oo loo kala saaro goobo kala duwan. Waa hawl!

Qaybta ay hadda haystaan ​​waa la sii joogayaa, laakiin domainka cusubi wuxuu ka kooban yahay dhammaan waxyaabaha la xiriira sheygaas… sawirrada, qoraallada, daraasaadka kiisaska, soo degsashada, foomamka, saldhigga aqoonta, iwm. 'ha seegin hal hanti.

Mar alla markii aan helnay goobta cusub oo shaqeyneysa, waqtigii aan soo jiidan lahayn badhanka oo aan toos u dhigno ayaa yimid. Taas macnaheedu waxa weeye in URL kasta oo ka socda bogga aasaasiga ah ee alaabtan lahaa in loo wareejiyo qaybta cusub. Waxaan marinay waddooyin badankood kuwo iswaafaqsan inta udhaxeysa boggaga, sidaas darteed furaha ayaa si habsami leh u dejinayay jihooyinka.

Toosiinta Plugins ee WordPress

Waxaa jira laba nooc oo caan ah oo la heli karo oo shaqo weyn ka qabta maaraynta dib u habeynta WordPress:

  • hagidda - laga yaabee inay tahay qalabka ugu fiican suuqa, oo leh awood muujin joogto ah iyo xitaa qeybaha lagu maareeyo wareejintaada.
  • Rankmath SEO - sheygan SEO-ga ah ee khafiifka ahi waa neef hawo nadiif ah wuxuuna ka dhigayaa liistadayda Waxyaabaha ugu Wanaagsan ee WordPress suuqa. Waxay dib-u-jeedin u tahay qayb ka mid ah bixinta waxayna xitaa soo dejin doontaa xogta Hanuuninta haddii aad u soo haajirto.

Haddii aad isticmaaleyso mishiinka Maareynta WordPress ee la maareeyay sida WPEngine, waxay leeyihiin qayb ay ku maareeyaan dib u habeyn ka hor inta uusan qofku waligiis ku dhicin bartaada… muuqaal quruxsan oo qurux badan oo yareyn kara daahitaanka iyo korka martigelintaada.

Iyo, dabcan, waad awoodaa ku qor sharciyada dib-u-celinta faylkaaga .htaccess on your server WordPress… laakiin anigu ma aan kula talin lahaa Waxaad tahay hal qalad oo cinwaan ah oo ka fog sameynta bartaada aan la geli karin!

Sida Loo Abuuro Toosinta Regex

Tusaalaha aan kor ku soo sheegay, waxay umuuqan kartaa mid fudud in kaliya la sameeyo dib u habeyn caadi ah oo laga soo qaado shay-hoosaad illaa domain cusub iyo hoosaad-hoosaad:

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

Dhibaato ayaa jirta taas, in kastoo. Kawaran haddii aad qaybisay xiriiriyeyaal iyo ololeyaal leh xayeysiin loogu talagalay raadinta ololaha ama gudbinta? Bogaggaas si sax ah dib ugama jeedin doonaan Waxaa laga yaabaa in URL uu yahay:

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

Sababtoo ah waxaad qortay ciyaar sax ah, URL-kani meelna uma jeedin doono! Marka, waxaa laga yaabaa inaad isku daydo inaad ka dhigto hadal caadi ah oo aad ku darto cinwaanka cinwaanka URL:

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

Taasi way fiicantahay, laakiin wali waxaa jira dhibaatooyin dhowr ah. Marka hore, waxay u dhigantaa URL kasta oo leh / wax soo saarka-a / ku dhex jira oo dhammaantood u wada jeedda isla meeshii ay u socdeen. Marka dhammaan waddooyinkani waxay u weecan doonaan isla meeshii loo socday.

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

Tilmaamaha joogtada ahi waa aalad qurux badan, in kastoo. Marka hore, waad cusbooneysiin kartaa ishaada si aad u hubiso in heerka galka la aqoonsaday.

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

Taasi waxay hubin doontaa in kaliya heerka galka koowaad uu si sax ah u wareegi doono. Hadda dhibaatada labaad… sidee ku heli doontaa macluumaadka querystring ee lagu qabtay bogga cusub haddii dib-u-habeyntaada aysan ku jirin? Hagaag, tibaaxaha joogtada ahi waxay leeyihiin xal weyn oo sidoo kale:

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

Macluumaadka duurjoogta ayaa dhab ahaan la qabtay oo lagu lifaaqay halka loo socdo iyadoo la adeegsanayo doorsoomaha. Sidaas…

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

Si sax ah ayaa loogu weecin doonaa:

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

Maskaxda ku hay in kaarka duudduubku uu awood u siin doono shay kasta oo shaashadda ah in sidoo kale loo wareejiyo sidoo kale, markaa tan sidoo kale waa la awoodsiin doonaa:

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

U guuri doona:

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

Dabcan, tibaaxaha joogtada ahi way ka dhib badnaan karaan tan… laakiin waxaan kaliya doonayay inaan soo qaado muunad dhakhso leh oo ku saabsan sida loo sameeyo duubista 'rekort' regex redirect oo wax walba si nadiif ah ugu gudbisa degel cusub!

Maxay idinla tahay?

Boggani wuxuu isticmaalaa Akismet si loo yareeyo spam. Baro sida xogtaada faallooyinkaaga looga shaqeeyo.