Yambitsiraninso WordPress pamutu

Mutu wa WordPress Wowongolera

The redirection pulogalamu yowonjezera yomangidwa chifukwa cha WordPress ndi njira zabwino zokhazikitsira ndikuwongolera mayendedwe. Ndimagwiritsa ntchito tsambali ndipo ndakonza magulu anga azitsogoleredwe pazosinthidwa, maulalo othandizira, kutsitsa, ndi zina zambiri.

Komabe, ndinakumana ndi vuto lapadera pomwe ndili ndi proxy yotsutsana ndi kasitomala komwe WordPress ikuyenda panjira ... koma osati muzu wa tsambalo. Tsamba loyambirira likuchitika pa IIS ku Azure. IIS imatha kuyendetsa ndikuwongolera monga momwe tsamba lililonse lawebusayiti lingathere, koma vuto ndilakuti kasitomala uyu amafunika kuyika kasamalidwe kake pakukonzekera kwawo - ndipo ali otanganidwa kale.

Chosavuta ndichakuti mawonekedwe amtundu wa .htaccess sakuthekanso… tikuyenera kulembanso mu PHP. Monga yankho, timayendetsa zopempha ku WordPress kuti tidziwe ngati pali zomwe zingawunikiridwe m'njira zakale.

mu womet fayilo yamutu wathu wamwana, tili ndi ntchito:

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;
	}
}

Sitinadandaule kuyika ntchitoyi mu works.php chifukwa choti zingangokhudza fayilo yamutu. Kenako, mkati mwa fayilo ya header.php, timangokhala ndi mndandanda wazowongolera zonse:

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

Ndi ntchitoyi, mutha kufotokozanso mtundu womwe mukufuna kutumiziranso wopempha mutu, tangowusintha kuti ubwererenso ku 301 kuti injini zosakira zizilemekeza.

Mukuganiza chiyani?

Tsambali likugwiritsa ntchito Akismet kuchepetsa spam. Phunzirani momwe deta yanu ikufotokozera.