Hello, everyone, I'm from China.Today I share with you about amending the wordpress function to achieve a 301 redirect,This function is wp-blog-header.php,The specific process is as follows:
1.To find the root of the site following the wp-blog-header.php file, make a backup
2.The use of professional programming tool to open this file, I am using Dreamweaver
3.The best place to start of file, enter the following code:
<?php
if (strtolower($_SERVER['SERVER_NAME'])!='www.kerry86.com')
{
$URIRedirect=$_SERVER['REQUEST_URI'];
if(strtolower($URIRedirect)=="/index.php") { $URIRedirect="/"; }
header('HTTP/1.1 301 Moved Permanently');
header('Location:http://www.kerry86.com'.$URIRedirect);
exit();
}
?>
4.To cover the wp-blog-header.php file of the web root directory