一、301跳转
1、index.php
<?php include("301.inc.php"); //301 Redirect ?>
<?php
/**
* @version $Id: index.php 1 9:23 2010-11-11 tianya $
* @package DedeCMS.Site
* @copyright Copyright (c) 2011 - 2012, DesDev, Inc.
* @link http://www.posuijish.com
*/
$HOST=$_SERVER[‘HTTP_HOST‘];
if ($HOST=="crazyiter.com" || $HOST=="crazyiter.dns143.53nic.com"){
Header("HTTP/1.1 301 Moved Permanently");
Header("Location:http://www.posuijish.com");
exit();
}
if(!file_exists(dirname(__FILE__).‘/data/common.inc.php‘))
{
header(‘Location:install/index.php‘);
exit();
}
//自动生成HTML版
if(isset($_GET[‘upcache‘]) || !file_exists(‘index.html‘))
{
require_once (dirname(__FILE__) . "/include/common.inc.php");
require_once DEDEINC."/arc.partview.class.php";
$GLOBALS[‘_arclistEnv‘] = ‘index‘;
$row = $dsql->GetOne("Select * From `#@__homepageset`");
$row[‘templet‘] = MfTemplet($row[‘templet‘]);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row[‘templet‘]);
$row[‘showmod‘] = isset($row[‘showmod‘])? $row[‘showmod‘] : 0;
if ($row[‘showmod‘] == 1)
{
$pv->SaveToHtml(dirname(__FILE__).‘/index.html‘);
include(dirname(__FILE__).‘/index.html‘);
exit();
} else {
$pv->Display();
exit();
}
}
else
{
header(‘HTTP/1.1 301 Moved Permanently‘);
header(‘Location:index.html‘);
}
?>
2、301.inc.php
<?php
$the_host = $_SERVER[‘HTTP_HOST‘];
$request_uri = isset($_SERVER[‘REQUEST_URI‘]) ? $_SERVER[‘REQUEST_URI‘] : ‘‘;
if($the_host !== ‘posuijish.com‘)
{
header(‘HTTP/1.1 301 Moved Permanently‘);
header(‘Location: http://www.posuijish.com‘);
}
?>
3、.htacess
# 将 RewriteEngine 模式打开
RewriteEngine On
# Rewrite 系统规则请勿修改
RewriteCond %{HTTP_HOST} ^posuijish.com [NC]
RewriteRule ^(.*)$ http://www.posuijish.com/$1 [L,R=301]
4、httpd.ini
[ISAPI_Rewrite]
# 重定向
RewriteCond Host: ^posuijish\.com$
RewriteRule (.*) http://www.posuijish.com$1 [RP,I]
RewriteRule ^(.*)/index\.html$ $1/ [RP,I]
二、404设置
1、 404.html
服务器登陆设置可以设置404
2、163ns.com网站虚拟主机管理-》主机控制面板-》自定义错误-》HTTP错误:404消息类型url内容404.htm