Dzorerazve WordPress muMusoro

WordPress Musoro Kutungamira

The redirection plugin yakavakirwa yeWordPress inzira inoshamisa yekuronga uye kugadzirisa kudzosera kumashure. Ini ndinoishandisa pane ino saiti uye ndakaronga mapoka angu ezvidzore zvekuvandudzwa kwemapositi, ehukama zvinongedzo, kurodha pasi, nezvimwe.

Nekudaro, ini ndakamhanyira mune rakasarudzika dambudziko kwandave ne reverse proxy yakamisirwa mutengi iyo WordPress iri kumhanya munzira… asi kwete mudzi wesaiti. Iyo yekutanga saiti iri kumhanya pane IIS muAzure. IIS inokwanisa kudzora redirects sekugona kwese kunoita dura rewebhu, asi dambudziko nderekuti mutengi uyu angangoda kuisa redirect manejimendi mune yavo yekuvandudza maitiro - uye ivo vakabatikana kare.

Panyaya ndeyekuti zvakajairika .htaccess dhizaini redirect hazvigone… isu tinofanirwa kunyora zvidzoreso muPHP. Semhinduro, isu tinofambisa zvikumbiro kuWordPress kuti tione kana paine chero marongedzero munzira dzekare.

Vomuyaimbova header.php faira remusoro wedu wemwana, isu tine basa:

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

Hatina kunetsekana nekuisa basa mumabasa.php kungoti nekuti zvingangove zvichikanganisa musoro wefaira. Ipapo, mukati meiyo header.php faira, isu tinongova nerunyorwa rwese anodzokorodza:

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

Nebasa iro, iwe unogona zvakare kudoma kuti ndeupi rudzi rwekutungamira kwaungade kumisikidza iyo header chikumbiro kuna, isu tangoichinjisa iyo kune 301 redirect kuitira kuti injini dzekutsvaga dzizokudze.

Unofungei?

Nzvimbo iyi inoshandisa Akismet kuderedza spam. Dzidza kuti sei deta yako inoshandiswa.