设为首页收藏本站

Scripts 学盟

 找回密码
 加入学盟

QQ登录

只需一步,快速开始

查看: 5584|回复: 5
打印 上一主题 下一主题

Discuz! 7.2 升到 x2.0 版本后的 seo 问题 [复制链接]

管理员

超级大菜鸟

Rank: 9Rank: 9Rank: 9

跳转到指定楼层
1#
因为看上了,QQ互联。

学盟把论坛从 Discuz! 7.2 升级到了 x2.0 版本

但是 x2.0 的结构变了。。。

搜索引擎原来收录的页面地址就都 404 了

这对 seo 来说,可是很严重很严重的问题!!!


当然了,如果你使用了伪静态的话,就不会有这麻烦了。。。只要应用相同效果的 urlrewrite 规则就好了



如果你跟学盟一样,没有用伪静态,这可不爽了。

如果想尽可能的降低升级对 seo 的影响,我们必须得让原有页面返回 301 的 http 状态,并重定向到新的页面地址

好在,从 7.2  转到 x2 的页面,请求地址的变化是有规则的。。。


先用 site:iscripts.org  从搜索引擎看了一下

除了首页外,收录的内容主要是:
/viewthread.php?....
/redirect.php?....
/forumdisplay?....

那么,我们现在可以在 discuz! x2 根目录也分别建立这样三个文件

viewthread.php
  1. <?php

  2. $params =  $_SERVER['QUERY_STRING'];

  3. if (empty($params)) {
  4.         header("HTTP/1.1 404 Not Found");
  5. } else {
  6.         header("HTTP/1.1 301 Moved Permanently");
  7.         header("Location: http://www.iscripts.org/forum.php?mod=viewthread&".$params);
  8. }

  9. ?>
复制代码
redirect.php
  1. <?php

  2. $params =  $_SERVER['QUERY_STRING'];

  3. if (empty($params)) {
  4.         header("HTTP/1.1 404 Not Found");
  5. } else {
  6.         header("HTTP/1.1 301 Moved Permanently");
  7.         header("Location: http://www.iscripts.org/forum.php?mod=redirect&".$params);
  8. }

  9. ?>
复制代码
forumdisplay.php
  1. <?php

  2. $params =  $_SERVER['QUERY_STRING'];


  3. if (empty($params)) {
  4.         header("HTTP/1.1 404 Not Found");
  5. } else {
  6.         header("HTTP/1.1 301 Moved Permanently");
  7.         header("Location: http://www.iscripts.org/forum.php?mod=forumdisplay&".$params);
  8. }
  9. ?>
复制代码
这样子,当用户用旧论坛帖子和版块页地址访问时,就会被 301 重定向到新论坛页面。



再过一段时间,搜索引擎的编录信息也会慢慢的更新过来。。。

当然,你也可以再对 rss.php.... ,  tag.php.... 等页面做类似的重定向

可以有力度的缩小 升级对 seo 带来的影响。
分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
分享分享0 收藏收藏0

管理员

超级大菜鸟

Rank: 9Rank: 9Rank: 9

2#
混混@普宁.中国 实名认证  发表于 2011-5-25 14:58:26 |只看该作者
呵呵,瞎折腾了那么久

原来在 discuz_X2_SC_UTF8.zip 中就提供了

里面 utility/oldprg/discuz/ 目录下,就有

attachment.php
forumdisplay.php
redirect.php
viewthread.php

里面就用类似的代码,分别做了 301 重定向。



---------------

一般这样子也就解决了。。。

但是这次我没这么幸运,在 google 的网站管理员工具中,google 提示网站出现很多 “软404”页面。

看了一下,就是这些页面。。。

为什么呢???我都在代码中做了 301 重定向了呀。。。

马上用工具测试一下,请求这些页面返回状态竟然都是 302!!!

难道代码写错了。。我的代码错,那 discuz 提供的代码该不会错了吧,试了又试,改了又改,在本地测试通过,传上空间再试就不行。。。

无论如何,只要在 php 中用了 header("location: ..."); 传上服务器,请求到的状态结果都是: 302 Recirect

不知道是不是 godaddy win 主机的问题。。。反正就是在代码上,无从下手了

----------------

摆渡下,发现有人说到 godaddy iis7 主机可以在 web.config 文件中配置重定向,呵呵。。。

找个例子参考,写下:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3.     <system.webServer>
  4.         <rewrite>
  5.             <rules>
  6.                 <rule name="Redirect 1">
  7.                     <match url="^bbs/viewthread\.php$" ignoreCase="true" />
  8.                     <action type="Redirect" url="http://www.iscripts.org/forum.php?mod=viewthread" redirectType="Permanent" appendQueryString="true" />
  9.                 </rule>
  10.                 <rule name="Redirect 2">
  11.                     <match url="^bbs/forumdisplay\.php$" ignoreCase="true" />
  12.                     <action type="Redirect" url="http://www.iscripts.org/forum.php?mod=forumdisplay" redirectType="Permanent" appendQueryString="true" />
  13.                 </rule>
  14.                 <rule name="Redirect 3">
  15.                     <match url="^bbs/redirect\.php$" ignoreCase="true" />
  16.                     <action type="Redirect" url="http://www.iscripts.org/forum.php?mod=redirect" redirectType="Permanent" appendQueryString="true" />
  17.                 </rule>
  18.                 <rule name="Redirect 4">
  19.                     <match url="^bbs/(index\.php)?$" ignoreCase="true" />
  20.                     <action type="Redirect" url="http://www.iscripts.org/forum.php" redirectType="Permanent" appendQueryString="true" />
  21.                 </rule>
  22.                 <rule name="Redirect 5">
  23.                     <match url="^bbs/tag.php$" ignoreCase="true" />
  24.                     <action type="Redirect" url="http://www.iscripts.org/misc.php?mod=tag" redirectType="Permanent" appendQueryString="true" />
  25.                 </rule>
  26.                 <rule name="Redirect 6">
  27.                     <match url="^bbs/faq\.php$" ignoreCase="true" />
  28.                     <action type="Redirect" url="http://www.iscripts.org/misc.php?mod=faq" redirectType="Permanent" appendQueryString="true" />
  29.                 </rule>
  30.                 <rule name="Redirect 7">
  31.                     <match url="^bbs/rss\.php$" ignoreCase="true" />
  32.                     <action type="Redirect" url="http://www.iscripts.org/forum.php?mod=rss" redirectType="Permanent" appendQueryString="true" />
  33.                 </rule>
  34.                 <rule name="Redirect 8">
  35.                     <match url="^bbs/archiver(/(index.php)?)?$" ignoreCase="true" />
  36.                     <action type="Redirect" url="http://www.iscripts.org/archiver/" redirectType="Permanent" appendQueryString="true" />
  37.                 </rule>
  38.             </rules>
  39.         </rewrite>
  40.     </system.webServer>
  41. </configuration>
复制代码
传上去,再测试一下。

OK!!!

终于搞定。。。。

使用道具 举报

Rank: 8Rank: 8

3#
那个谁 发表于 2011-5-25 16:10:03 |只看该作者
混混好强大。。。男人不能是万能的哦。。。要专一哦。。。。。
混混很花心,啥都沾哦。。有木有有木有、。。。

使用道具 举报

管理员

超级大菜鸟

Rank: 9Rank: 9Rank: 9

4#
混混@普宁.中国 实名认证  发表于 2011-5-25 17:06:59 |只看该作者
那个谁 发表于 2011-5-25 16:10
混混好强大。。。男人不能是万能的哦。。。要专一哦。。。。。
混混很花心,啥都沾哦。。有木有有木有、。 ...



混混哪里有花心,这是博爱 博爱

使用道具 举报

Rank: 1

5#
小丁 发表于 2011-5-27 19:28:37 |只看该作者
不知如何才能实现wordpres到discuzX  重定向不会损失!!!!!!

使用道具 举报

管理员

超级大菜鸟

Rank: 9Rank: 9Rank: 9

6#
混混@普宁.中国 实名认证  发表于 2011-5-27 20:07:11 |只看该作者
小丁 发表于 2011-5-27 19:28
不知如何才能实现wordpres到discuzX  重定向不会损失!!!!!!

e,  没有用过 wp

你可以提供个例子,从什么样的 url 转向到另外什么样的 url

使用道具 举报

您需要登录后才可以回帖 登录 | 加入学盟

手机版|Scripts 学盟   |

GMT+8, 2024-4-24 08:10 , Processed in 1.171135 second(s), 11 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部