301重定向代码(php apache)
使用 HTACCESS 文件 添加吧,这是代码:
Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^domain测试数据[NC] RewriteRule ^(.*)$ http://HdhCmsTestphpfensi测试数据/$1 [L, R = 301 ]php写法:
<? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: HdhCmsTestphpfensi测试数据" ); ?>不带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://HdhCmsTestphpfensi测试数据" ); exit ();} ?>查看更多关于301重定向代码(php apache) - php高级应用的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did29890