Nkọwa Ọhụụ Ọhụrụ (Regex) Redirects Na WordPress

Regex - Okwu mgbe niile

N'ime izu ole na ole gara aga, anyị na-enyere onye ahịa aka ime ngagharị dị mgbagwoju anya na WordPress. Onye ahịa ahụ nwere ngwaahịa abụọ, nke abụọ abụrụla ndị a ma ama ruo n'ókè nke na ha ga-ekewapụ azụmahịa, akara ngosi, na ọdịnaya ahụ iji kewaa ngalaba. Ọ bụ nnọọ ọrụ!

A na-etinye ngalaba ha dị ugbu a, mana ngalaba ọhụrụ ga-enwe ọdịnaya niile gbasara ngwaahịa ahụ… site na onyonyo, ozi, ọmụmụ ihe, nbudata, ụdị, ihe ọmụma, wdg. echefula otu akụ.

Ozugbo anyị nwere saịtị ọhụrụ ahụ ebe anyị na arụ ọrụ, oge iji dọpụ ihe mgba ọkụ ma debe ya ndụ eruola. Nke ahụ pụtara na URL ọ bụla sitere na saịtị mbụ bụ nke ngwaahịa a ga-atụgharị ya na ngalaba ọhụrụ. Anyị debere ọtụtụ ụzọ na-agbanwe agbanwe n'etiti saịtị, yabụ igodo na-edozi redirezi n'ụzọ kwesịrị ekwesị.

Redirect Plugins na WordPress

E nwere ihe mgbakwunye abụọ a ma ama nke na-arụ nnukwu ọrụ nke ijikwa redirects na WordPress:

  • Redirection - ikekwe ngwa mgbakwunye kachasị mma na ahịa, nwere ike igosipụta oge yana ọbụnadị edemede maka ijikwa redire gị.
  • Ọnọdụ SEO - SEO nke a dị fechaa bụ ikuku nke ikuku ma na-eme ndepụta m Ihe kacha mma WordPress n'ahịa. Ọ redirects dị ka akụkụ nke onyinye ya na ọ ga - ebubata data Redirection ma ọ bụrụ na ịkwaga ya.

Ọ bụrụ na ị na-eji njikwa WordPress Bochum jisiri ike dị ka WPEngine, Ha nwere modul na-eme redirects tupu onye ahụ akụrisị saịtị gị… mara mma mara mma nke nwere ike belata ịdị larịị na ịgafe na Bochum gị.

Ma, n’ezie, ị nwere ike dee iwu ntụgharị n'ime faịlụ .htaccess gị na gị WordPress nkesa… ma m ga-akwado ya. You're nọ otu mmehie mmeghe na-eme ka saịtị gị ghara ịbanye!

Etu esi mepụta Regex Redirect

N'ihe atụ m nyere n'elu, ọ nwere ike ịdị ka ọ dị mfe ịmegharị ntụgharị sitere na folda ọhụrụ na ngalaba ọhụrụ na folda ọhụrụ:

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

Enwere nsogbu na nke ahụ. Gịnị ma ọ bụrụ na ị kesara njikọ na mkpọsa nwere querystring maka mkpọsa nsuso ma ọ bụ Ntuziaka? Ibe ndị ahụ agaghị emegharị nke ọma. Ikekwe URL bụ:

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

Maka na ịdechara egwuregwu, URL ahụ agaghị emegharị ebe ọ bụla! Yabụ, enwere ike ịnwa gị ịme ya ka ọ bụrụ ngosipụta oge niile ma gbakwunye ederede na URL:

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

Nke ahụ dị ezigbo mma, mana enwere nsogbu ole na ole. Nke mbụ, ọ ga-adaba na URL ọ bụla / ngwaahịa-a / n'ime ya ma degharịa ha niile n'otu ebe. Yabụ ụzọ ndị a niile ga-emegharị n'otu ebe.

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

Okwu mgbe nile bu ngwa oru mara nma. Nke mbụ, ịnwere ike imelite isi mmalite gị iji hụ na amata ọkwa folda ahụ.

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

Nke ahụ ga - ahụ na naanị ọkwa folda mbụ ga - emegharị nke ọma. Ugbu a maka nsogbu nke abụọ… kedu ka ị ga - esi nweta ozi querystring weghaara na saịtị ọhụrụ ahụ ma ọ bụrụ na redirect gị etinyeghị ya? Ngosipụta oge niile nwere nnukwu azịza maka nke ahụ:

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

A na - ejide ozi ozi anụ ọhịa ahụ wee tinye ya na mgbakwunye site na iji mgbanwe ahụ. Ya mere…

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

Ga-agazigharị nke ọma na:

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

Buru n'uche na anụ ọhịa ahụ ga-eme ka folda nchekwa ọ bụla nwee ike ibugharị ya, yabụ a ga-emekwa ka:

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

Ga-ebugharị na:

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

N'ezie, nkwupụta oge niile nwere ike ịdị mgbagwoju anya karịa nke a… mana achọrọ m ịnye ngwa ngwa etu esi esetịpụ redika regex ntụgharị nke na-agafe ihe niile n'ụzọ dị ọcha na ngalaba ọhụrụ!

Kedu ihe ị chere?

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.