+ -
当前位置:首页 → 问答吧 → [非原创]用301定向实现子域名

[非原创]用301定向实现子域名

时间:2009-12-12

来源:互联网

有的空间不支持子域名,让大家感到比较不爽吧?现在,用它说可以简单实现不能绑子目录的空间也实现子域名。
<?php //本程序由 uit88 修改! $mydomin = $_SERVER['HTTP_HOST'];//获取输入的域名 switch ($mydomin) { case ("www.023wo.com") : header('HTTP/1.1 301 Moved Permanently');//发出301头部信息 header('Location: [url]http://www.023wo.com/wo'[/url]); //跳转到相应域名目录 break; case ("023wo.com") : header('HTTP/1.1 301 Moved Permanently'); header('Location: [url]http://www.023wo.com/wo'[/url]); break; case ("www.sionwes.com") : header('HTTP/1.1 301 Moved Permanently'); header('Location: [url]http://www.sionwes.com/studio'[/url]); break; case ("sionwes.com") : header('HTTP/1.1 301 Moved Permanently'); header('Location: [url]http://www.sionwes.com/studio'[/url]); break; case ("www.lansiru.com") : header('HTTP/1.1 301 Moved Permanently'); header('Location: [url]http://www.lansiru.com/siru'[/url]); break; case ("lansiru.com") : header('HTTP/1.1 301 Moved Permanently'); header('Location: [url]http://www.lansiru.com/siru'[/url]); break; } ?>
很简单吧!听说用301对SEO也比较友好。

作者: uit88   发布时间: 2009-12-12

自己顶

作者: uit88   发布时间: 2009-12-12

我顶~

作者: 邹梨明   发布时间: 2009-12-13

没人顶啊

作者: uit88   发布时间: 2009-12-13

支持下,已用好多年   效果不错的

作者: shengsibu   发布时间: 2009-12-13