要做301转向有好的代码不 

解决方案 »

  1.   

    两种方法:
    1.apache做rewrite
    2.<?php 
    $url="http://www.php.net".$_SERVER["REQUEST_URI"]; 
    header("HTTP/1.1 301 Moved Permanently"); 
    header ("Location:$url"); 
    ?> 
      

  2.   

    [ISAPI_Rewrite]
      # 3600 = 1 hour
    CacheClockRate 3600
    # Collected By 17hezu.com
    RepeatLimit 32
    RewriteCond Host: ^gvodfans\.cn$
    RewriteRule (.*) http\://www\.gvod8\.com$1 [I,RP]
    RewriteCond Host: ^gvod8\.com$
    RewriteRule (.*) http\://www\.gvod8\.com$1 [I,RP]
    RewriteCond Host: ^^www\.gvodfans\.cn$
    RewriteRule (.*) http\://www\.gvod8\.com$1 [I,RP]
    RewriteEngine On
    RewriteRule ^(.*)-htm-(.*)$ $1.php\?$2
    RewriteRule ^(.*)/([a-zA-Z]+)-(.*.html.*)$ $1/$2.php\?$3
    RewriteRule ^/([a-zA-Z]+).html.*$ /$1.php