htaccess: Rubutun Jaka da Sauya tare da Regex

sake turawa

Sauƙaƙe tsarin URL ɗinku hanya ce mai kyau don haɓaka rukunin yanar gizonku saboda dalilai da yawa. Dogayen URLs suna da wahalar rabawa tare da wasu, ana iya yanke su a cikin editocin rubutu da editocin imel, kuma tsarin manyan fayilolin URL na iya aika sigina mara kyau zuwa injunan bincike akan mahimmancin abun cikin ku.

Idan rukunin yanar gizonku yana da URLs biyu:

  • https://martech.zone/blog/category/search-engine-optimization/htaccess-folder-redirect-regex OR
  • https://martech.zone/htaccess-folder-redirect-regex

Wanne zaku tsammani ya samar da labarin mafi mahimmanci? Misali na farko yana da rabuwa tsakanin labarin da shafin gida na matakan 5. Idan kun kasance injin bincike, shin kuna tsammanin wannan yana da mahimmancin abun ciki?

Saboda waɗannan dalilai, muna sauƙaƙa yawancin tsarin babban fayil na abokan cinikinmu. Wadansu na iya yin jayayya cewa wasu rukuni na rukuni tare da kalmomin suna da kyau, amma ba mu ga wannan tare da abokanmu ba. Matsayi da yawan hanyoyin haɗi daga shafin gida sun haifar da darajoji mafi kyau tare da shahararrun abubuwanmu.

Bayan aiwatar da bulogi, kodayake, yana da ɗan zafi don warware duk waɗannan haɗin haɗin dindindin kuma har yanzu yana sake tura zirga-zirga daga hanyoyin da ke akwai zuwa sabon tsarin URL. Tare da Flywheel (haɗin haɗin gwiwa), za mu iya samun ƙungiyar su gudanar da sake turawar mu ko za mu iya amfani da fulogin sauyawa.

  1. Na farko, muna aiki Yoast's WordPress SEO plugin domin mu iya tsinkayar zahiri category tutsar sulug daga URL.
  2. Abu na gaba, zamu sabunta permalinks kuma mu cire /% rukuni% / kuma kawai mu bar /% post% / a cikin filin (kuma ku wartsake cache).
  3. Na ƙarshe, dole ne mu ƙara magana ta yau da kullun don sake juya babban fayil ɗin:

tsiri-fayil-redirect-regex

Maganganun yana da rukunin zaɓin zaɓinku da aka jera (folder1, folder2, folder3) kuma yana buƙatar ɗan rubutu bayan rukunin your ta wannan shafin rukunoninku ba zasu karye ba amma labarai masu zaman kansu zasu tura da kyau zuwa sabon URL.

^/(folder1|folder2|folder3)/([a-zA-Z0-9_.-]+)$

Ban tabbata ba zan ba da shawarar wannan gagarumin canjin ga kowane kamfani ba. Waɗanda ke da matsayin da aka kafa ba za su so tura wannan ba. A cikin gajeren lokaci, zai iya cutar da martabarku tunda turawa baya ɗaukar duk ikon asalin shafin. Amma bayan lokaci, samun ƙarin abun ciki mafi girma a cikin tsarin mulkinku na yau da kullun zai iya taimaka muku. Mun san an taimaka Martech Zone!

Me kuke tunani?

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