301重定向代码 php apache
发布时间:2022-01-19 20:21:43 所属栏目:PHP教程 来源:互联网
导读:使用 HTACCESS 文件 添加吧,这是代码: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com[NC] RewriteRule ^(.*)$ http://www.Cuoxin.com/$1 [L,R=301] php写法: ? Header( HTTP/1.1 301 Moved Permanently ); Header( Locati
使用 HTACCESS 文件 添加吧,这是代码: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com[NC] RewriteRule ^(.*)$ http://www.Cuoxin.com/$1 [L,R=301] php写法: <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: www.Cuoxin.com" ); ?> 不带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.Cuoxin.com"); exit();} ?> ![]() (编辑:ASP站长) 【免责声明】本站内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。 |
相关内容
未处理完善
-
无相关信息
最新更新