Phinda uthumele iWindowsPress kwiNtloko

Ukubuyela kwakhona kwi-WordPress

The redirection iplagi eyakhelwe iWindowsPress yindlela emnandi yokuququzelela kunye nokulawula ukuhanjiswa kwakhona. Ndiyisebenzisa kule ndawo kwaye ndiququzelele amaqela am okuhambisa kwakhona iiposti ezihlaziyiweyo, amakhonkco onxibelelwano, ukhuphelo, njl.

Nangona kunjalo, ndabaleka ndaya kwingxaki eyahlukileyo apho ndinommeleli obuyela umva osethelwe umthengi apho iWindowsPress isebenza ngendlela… kodwa hayi ingcambu yesiza. Indawo ephambili isebenza kwi-IIS eAzure. IIS inokulawula ukuphinda uqondise kwakhona njengoko nayiphi na iserver yewebhu inokwenza, kodwa ingxaki kukuba lo mthengi uya kufuna ukubeka ulawulo kwakhona kwinkqubo yabo yophuhliso-kwaye sele bexakekile.

Umcimbi kukuba isitayile esiqhelekileyo .htaccess yokuqondisa kwakhona ayisiyiyo… kufuneka sinyanzele sibhale kwakhona kwi-PHP. Njengesisombululo, sihambisa izicelo kwiWordPress ukuze sichonge ukuba ngaba kukho naziphi na iindlela ezibuyela umva kwiindlela ezindala.

Ngaphakathi okuphezulu.php ifayile yomxholo wethu womntwana, sinomsebenzi:

function my_redirect ($oldlink, $newlink, $redirecttype = 301) {
	$olduri = $_SERVER['REQUEST_URI'];
	if(strpos($olduri, $oldlink) !== false) {
		$newuri = str_replace($oldlink, $newlink, $olduri);
		wp_redirect( $newuri, $redirecttype );
		exit;
	}
}

Khange sizikhathaze ngokubeka umsebenzi kwimisebenzi.php kuba oko kuya kuba nefuthe kwifayile yesihloko. Ke ngaphakathi kwifayile yentloko.php, sinoluhlu nje lwazo zonke izikhombisi:

my_redirect('lesson_plans', 'lesson-plan');
my_redirect('resources/lesson-plans/26351', 'lesson-plan/tints-and-shades');
my_redirect('about/about', 'about/company/');

Ngalo msebenzi, ungakhankanya nokuba loluphi uhlobo lokuphinda uhambise isicelo ongathanda ukuseta isicelo sentloko kulo, sisandul 'ukusilela kulungelelwaniso olungama-301 ukuze iinjini zokukhangela zizukise.

Ingaba ucinga ntoni?

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