Chinaunix首页 | 论坛 | 博客
  • 博客访问: 180836
  • 博文数量: 223
  • 博客积分: 8190
  • 博客等级: 中将
  • 技术积分: 2410
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-01 07:04
文章分类

全部博文(223)

文章存档

2012年(20)

2011年(203)

我的朋友

分类: WINDOWS

2011-09-07 12:00:48

核心降示:前段工夫由于网坐发展需要,将论坛从原主坐子目录中独立入来,原来的域名***.com/bbs更换为***.com,为了保证原有良好收录和权重(PR为5),也保证原有地址可以访问,所以需要想办法在不被判为做弊的状况下将原有论坛中每个页面的地址转向到对应

前段工夫由于网坐发展需要,将论坛从原主坐子目录中独立入来,原来的域名***.com/bbs更换为***.com,为了保证原有良好收录和权重(PR为5),也保证原有地址可以访问,所以需要想办法在不被判为做弊的状况下将原有论坛中每个页面的地址转向到对应新地址。

开始没有想到直接在服务器上设置301转向,而是通过对404页面来路的分析进行了这样的设置:用PHP做页面如error.php,然后定义入错404转向页为error.php,然后在error.php中用$_SERVER[‘QUERY_STRING’];获取入错来路中的字符串(其中包露你原来的访问地址),然后再用字符串替换函数替换成新的就行了。这样论坛访问地址由***.com/bbs完全转化为***com访问,并且保证用户通过原链接如

***.com/bbs/thread-1-236598-1.html可正常跳转到对应新域名,error.php页面代码如下:

PHP代码

以下为引用的外容:
";    echo "".$url."";    echo "window.location="".$url.""</script>";    }    else   {    echo "window.location="***.com"";    }    ?>   

前天在DISCUZ论坛看到有朋友说要换地址,想做301转向的,这才仔粗研究了下301转向的问题,发现其实之前走了弯路,

直接用301永久转向就行了,况且GOOGLE网坐管理员帮帮文件中也说明了301转向是可行的:

XML/HTML代码

以下为引用的外容:来源:google.com/support/webmasters/bin/answer.py?hl=enanswer=93633

If you need to change the URL of a page as it is shown in search engine results, we recommended that you

use a server-side 301 redirect. This is the best way to ensure that users and search engines are directed

to the correct page. The 301 status code means that a page has permanently moved to a new location.

301 redirects are particularly useful in the following circumstances:

You‘ve moved your site to a new domain, and you want to make the transition as seamless as possible.

People access your site through several different URLs. If, for example, your home page can be reached in

multiple ways - for instance, , , or example.com

- it’s a good idea to pick one of those URLs as your preferred (canonical) destination, and use 301

redirects to send traffic from the other URLs to your preferred URL. You can also use Webmaster Tools to

set your preferred domain.

You‘re merging two websites and want to make sure that links to outdated URLs are redirected to the

correct pages.

1 2 下一页
66互联 66idc.net
地方社区“定州365”上线1个月的心得
淘宝客戴仁光谈传统站长转型淘宝客经

阅读(390) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~