使用 HTACCESS 文件 添加吧,這是代碼
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com[NC]
RewriteRule ^(.*)$ http://www.111cn.net/$1 [L,R=301]
php教程寫法
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: www.111cn.net" );
?>
不帶index.php文件
<?php
$qurl = $_SERVER['REQUEST_URI'];
//獲取url,偽靜態地址也能完整取得
$qurl = str_replace("/index.php","",$qurl);
if ($qurl!=""){
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.111cn.net");
exit();}
?>