Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[教程] Linux + Apache 伪静态及搜索优化【X2.5】

[复制链接]
e1951点点 发表于 2012-4-29 21:56:58 | 显示全部楼层 |阅读模式
本帖最后由 e1951点点 于 2012-7-21 16:28 编辑

伪静态
第一步,设置伪静态支持
方法一:修改httpd.conf开启
打开APACHE  设置文件httpd.conf ,搜寻以下代码。(也许有多个,您论坛域名所在的那一个)
  1. <VirtualHost ****>
  2. ServerAdmin webmaster@e1951.com
  3. DocumentRoot ***
  4. ServerName bbs.e1951.com
  5. ErrorLog logs/e1951.com-error_log
  6. CustomLog logs/e1951.com-access_log common
  7. </VirtualHost>
复制代码
在"</VirtualHost>"上面添加如下代码:(伪静态规则,文章、帖子列表、帖子、群组、空间、日志、缺少Archiver
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteCond %{QUERY_STRING} ^(.*)$
  4. RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1
  5. RewriteCond %{QUERY_STRING} ^(.*)$
  6. RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1
  7. RewriteCond %{QUERY_STRING} ^(.*)$
  8. RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
  9. RewriteCond %{QUERY_STRING} ^(.*)$
  10. RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1
  11. RewriteCond %{QUERY_STRING} ^(.*)$
  12. RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
  13. RewriteCond %{QUERY_STRING} ^(.*)$
  14. RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1
  15. RewriteCond %{QUERY_STRING} ^(.*)$
  16. RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3&%1
  17. RewriteCond %{QUERY_STRING} ^(.*)$
  18. RewriteRule ^(.*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3&%1
  19. </IfModule>
复制代码
方法二:上传文件开启(但需要服务器环境支持)
复制下面代码,存为文件 .htaccess  后,上传到网站根目录。
  1. # 将 RewriteEngine 模式打开
  2. RewriteEngine On

  3. # 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
  4. RewriteBase /

  5. # Rewrite 系统规则请勿修改
  6. RewriteCond %{QUERY_STRING} ^(.*)$
  7. RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
  8. RewriteCond %{QUERY_STRING} ^(.*)$
  9. RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
  10. RewriteCond %{QUERY_STRING} ^(.*)$
  11. RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
  12. RewriteCond %{QUERY_STRING} ^(.*)$
  13. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
  14. RewriteCond %{QUERY_STRING} ^(.*)$
  15. RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
  16. RewriteCond %{QUERY_STRING} ^(.*)$
  17. RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
  18. RewriteCond %{QUERY_STRING} ^(.*)$
  19. RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
复制代码
第二步,后台开启伪静态
登录后台,全局 - SEO设置 - URL 静态化
将相关页面打上对勾,提交。

完成。

百度、谷歌搜索优化

参考帖子:https://discuz.dismall.com/thread-2474942-1-1.html

之前1.5用过,这次2.5也看到有地图,但是不太好用,就搜索到了上面的帖子,但问题很大,就参考之前1.5做了一定的修改。方法如下:

第一步:上传文件。

上传上面文件夹中的两个文件到source\include\cron目录下。

第二步:添加计划任务。
后台 - 工具 - 计划任务  添加计划任务。


填写地图文件的名称。


提交。完成。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
 楼主| e1951点点 发表于 2012-4-29 22:20:14 | 显示全部楼层
呵呵,挺辛苦的,给个IP吧。
免费地图文件下载地址:

http://bbs.e1951.com/thread-2-1-1.html
回复

使用道具 举报

有所为 发表于 2012-5-1 09:58:03 | 显示全部楼层
来看看学习了哦
回复

使用道具 举报

qicai520 发表于 2012-6-16 15:14:50 | 显示全部楼层
我的设计计划任务出现下列错误为啥截图您看一下

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

bugx 发表于 2012-6-17 21:12:10 | 显示全部楼层
qicai520 发表于 2012-6-16 15:14
我的设计计划任务出现下列错误为啥截图您看一下

手动建目录
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-4-23 22:11 , Processed in 0.116819 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表