wordpress 301超級(jí)簡(jiǎn)單 無(wú)效服務(wù)器額外支持

字號(hào):


    由于時(shí)間問(wèn)題,暫時(shí)沒(méi)有制作新的wordpress主題,先拿到wp官方主題twenty ten就是一頓nofollow伺候,保證url的唯一性,網(wǎng)站仍然保持使用postname的url命名方式作為固定鏈接,但是如何對(duì) wordpress 301處理了,之前的blog.iopenv.com現(xiàn)在轉(zhuǎn)到aaa.cn了。
    網(wǎng)上查了很多方法,有對(duì)apache的方法,又對(duì)iis的方法。下面我們說(shuō)一個(gè)最簡(jiǎn)單的方法:
    在你的wordpress根目錄下找到wp-blog-header.php文件,在第一個(gè)<?php 后面添加以下代碼
    if (strtolower($_server['server_name'])!='aaa.cn')
    {
    $uriredirect=$_server['request_uri'];
    if(strtolower($uriredirect)==/index.php)
    {
    $uriredirect=/;
    }
    header('http/1.1 301 moved permanently');
    header('location:http://aaa.cn’.$uriredirect);
    exit();
    }
    注意:aaa.cn改為你要跳轉(zhuǎn)到新的網(wǎng)站。