康盛产品如何在Apache环境下配置Rewrite规则

<p class="content">URL 静态化是一个利于搜索引擎的设置,通过 URL 静态化,达到原来是动态的 PHP 页面转换为静态化的 HTML 页面,当然,这里的静态化是一种假静态,目的只是提高搜索引擎的搜索量,Comsenz 旗下的产品 Discuz!、SupeSite/X-Space、ECShop、SupeV、UCHome 等都支持此功能。当然这个功能还需要服务器环境的支持,下面介绍一下如何在 Apache 服务器下配置 URL 静态化的 Rewrite 规则。


<p class="content">当然这里分两种情况,一种是独立主机用户,这部分用户拥有对主机的管理权限,因此配置起来比较方便一些。(注:这里就以 Discuz!6.1.0 的 Rewrite 规则为例,稍后在后面会列举出其他产品的 Rewrite 规则。


<p class="content">


<p class="content">首先确定您使用的 Apache 版本,及是否加载了 mod_Rewrite 模块。


<div class="content">Apache 1.x 的用户请检查 conf/httpd.conf 中是否存在如下两段代码:

<div class="content">
LoadModule Rewrite_module libexec/mod_Rewrite.so
AddModule mod_Rewrite.c

<p class="content">Apache 2.x 的用户请检查 conf/httpd.conf 中是否存在如下一段代码:


<p class="content">LoadModule Rewrite_module modules/mod_Rewrite.so


<p class="content">如果存在,那么在配置文件(通常就是 conf/httpd.conf)中加入如下代码。此时请务必注意,如果网站使用通过虚拟主机来定义,请务必加到虚拟主机配置,即 中去,如果加在虚拟主机配置外部将可能无法使用,改好后将 Apache 重启。


<div class="content">

RewriteEngine On
RewriteRule ^(.)/archiver/((fid|tid)-[\w-]+.html)$ $1/archiver/index.php?$2
RewriteRule ^(.
)/forum-([0-9]+)-([0-9]+).html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.
)/space-(username|uid)-(.+).html$ $1/space.php?$2=$3
RewriteRule ^(.*)/tag-(.+).html$ $1/tag.php?name=$2

# 将 RewriteEngine 模式打开 RewriteEngine On # 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 / RewriteBase /discuz # Rewrite 系统规则请勿修改 RewriteRule ^archiver/((fid|tid)-[\w\-]+\.html)$ archiver/index.php?$1 RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ viewthread.php?tid=$1&extra=page\%3D$3&page=$2 RewriteRule ^space-(username|uid)-(.+)\.html$ space.php?$1=$2 RewriteRule ^tag-(.+)\.html$ tag.php?name=$1

SupeSite/X-Space6.0 UC规则

RewriteEngine On ###Rewrite 系统规则请勿修改 RewriteRule ^/([0-9]+)/spacelist(.+)$ /index.php?uid/$1/action/spacelist/type$2 [L] RewriteRule ^/([0-9]+)/viewspace(.+)$ /index.php?uid/$1/action/viewspace/itemid$2 [L] RewriteRule ^/([0-9]+)/viewbbs(.+)$ /index.php?uid/$1/action/viewbbs/tid$2 [L] RewriteRule ^/([0-9]+)/(.*)$ /index.php?uid/$1/$2 [L] RewriteRule ^/([0-9]+)$ /index.php?uid/$1 [L] RewriteRule ^/action(.+)$ /index.php?action$1 [L] RewriteRule ^/category(.+)$ /index.php?action/category/catid$1 [L] RewriteRule ^/viewnews(.+)$ /index.php?action/viewnews/itemid$1 [L] RewriteRule ^/viewthread(.+)$ /index.php?action/viewthread/tid$1 [L] RewriteRule ^/mygroup(.+)$ /index.php?action/mygroup/gid$1 [L]

### 将 RewriteEngine 模式打开 RewriteEngine On ### 修改以下语句中的 /SupeSite 修改为你的SupeSite目录地址,如果程序放在根目录中,请将 /SupeSite 修改为 / RewriteBase / ### Rewrite 系统规则请勿修改 RewriteRule ^([0-9]+)/spacelist(.+)$ index.php?uid/$1/action/spacelist/type$2 [L] RewriteRule ^([0-9]+)/viewspace(.+)$ index.php?uid/$1/action/viewspace/itemid$2 [L] RewriteRule ^([0-9]+)/viewbbs(.+)$ index.php?uid/$1/action/viewbbs/tid$2 [L] RewriteRule ^([0-9]+)/(.*)$ index.php?uid/$1/$2 [L] RewriteRule ^([0-9]+)$ index.php?uid/$1 [L] RewriteRule ^action(.+)$ index.php?action$1 [L] RewriteRule ^category(.+)$ index.php?action/category/catid$1 [L] RewriteRule ^viewnews(.+)$ index.php?action/viewnews/itemid$1 [L] RewriteRule ^viewthread(.+)$ index.php?action/viewthread/tid$1 [L] RewriteRule ^mygroup(.+)$ index.php?action/mygroup/gid$1 [L]

ECShop2.6.0 规则

RewriteEngine On RewriteRule ^(.*)/index.html$ $1/index.php RewriteRule ^(.*)/category$ $1/index.php [L] RewriteRule ^(.*)/feed-c([0-9]+).xml$ $1/feed.php?cat=$2 [L] RewriteRule ^(.*)/feed-b([0-9]+).xml$ $1/feed.php?brand=$2 [L] RewriteRule ^(.*)/feed.xml$ $1/feed.php RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/category.php?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6&page=$7&sort=$8&order=$9 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)\.html$ $1/category.php?id=$2&brand=$3&price_min=$4&price_max=$5&filter_attr=$6 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/category.php?id=$2&brand=$3&page=$4&sort=$5&order=$6 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ $1/category.php?id=$2&brand=$3&page=$4 RewriteRule ^(.*)/category-([0-9]+)-b([0-9]+)(.*)\.html$ $1/category.php?id=$2&brand=$3 RewriteRule ^(.*)/category-([0-9]+)(.*)\.html$ $1/category.php?id=$2 RewriteRule ^(.*)/goods-([0-9]+)(.*)\.html$ $1/goods.php?id=$2 RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ $1/article_cat.php?id=$2&page=$3&sort=$4&order=$5 RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)(.*)\.html$ $1/article_cat.php?id=$2&page=$3 RewriteRule ^(.*)/article_cat-([0-9]+)(.*)\.html$ $1/article_cat.php?id=$2 RewriteRule ^(.*)/article-([0-9]+)(.*)\.html$ $1/article.php?id=$2 RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html $1/brand.php?id=$2&cat=$3&page=$4&sort=$5&order=$6 RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html $1/brand.php?id=$2&cat=$3&page=$4 RewriteRule ^(.*)/brand-([0-9]+)-c([0-9]+)(.*)\.html $1/brand.php?id=$2&cat=$3 RewriteRule ^(.*)/brand-([0-9]+)(.*)\.html $1/brand.php?id=$2 RewriteRule ^(.*)/tag-(.*)\.html $1/search.php?keywords=$2 RewriteRule ^(.*)/snatch-([0-9])\.html$ $1/snatch.php?id=$2 RewriteRule ^(.*)/group_buy-([0-9])\.html$ $1/group_buy.php?act=view&id=$2

RewriteEngine On #RewriteBase / # direct one-word access RewriteRule ^index\.html$ index\.php [L] RewriteRule ^category$ index\.php [L] # access any object by its numeric identifier RewriteRule ^feed-c([0-9]+)\.xml$ feed\.php\?cat=$1 [L] RewriteRule ^feed-b([0-9]+)\.xml$ feed\.php\?brand=$1 [L] RewriteRule ^feed\.xml$ feed\.php [L] RewriteRule ^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 [QSA,L] RewriteRule ^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$ category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 [QSA,L] RewriteRule ^category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ category\.php\?id=$1&brand=$2&page=$3&sort=$4&order=$5 [QSA,L] RewriteRule ^category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ category\.php\?id=$1&brand=$2&page=$3 [QSA,L] RewriteRule ^category-([0-9]+)-b([0-9]+)(.*)\.html$ category\.php\?id=$1&brand=$2 [QSA,L] RewriteRule ^category-([0-9]+)(.*)\.html$ category\.php\?id=$1 [QSA,L] RewriteRule ^goods-([0-9]+)(.*)\.html$ goods\.php\?id=$1 [QSA,L] RewriteRule ^article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$ article_cat\.php\?id=$1&page=$2&sort=$3&order=$4 [QSA,L] RewriteRule ^article_cat-([0-9]+)-([0-9]+)(.*)\.html$ article_cat\.php\?id=$1&page=$2 [QSA,L] RewriteRule ^article_cat-([0-9]+)(.*)\.html$ article_cat\.php\?id=$1 [QSA,L] RewriteRule ^article-([0-9]+)(.*)\.html$ article\.php\?id=$1 [QSA,L] RewriteRule ^brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html brand\.php\?id=$1&cat=$2&page=$3&sort=$4&order=$5 [QSA,L] RewriteRule ^brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html brand\.php\?id=$1&cat=$2&page=$3 [QSA,L] RewriteRule ^brand-([0-9]+)-c([0-9]+)(.*)\.html brand\.php\?id=$1&cat=$2 [QSA,L] RewriteRule ^brand-([0-9]+)(.*)\.html brand\.php\?id=$1 [QSA,L] RewriteRule ^tag-(.*)\.html search\.php\?keywords=$1 [QSA,L] RewriteRule ^snatch-([0-9]+)\.html$ snatch\.php\?id=$1 [QSA,L] RewriteRule ^group_buy-([0-9]+)\.html$ group_buy\.php\?act=view&id=$1 [QSA,L] RewriteRule ^auction-([0-9]+)\.html$ auction\.php\?act=view&id=$1 [QSA,L]

SupeV1.0beta 规则

RewriteEngine On RewriteRule ^(.*)/ivideo(-tv-([0-9]+))?(-ti-([0-9]+))?(-tc-([0-9]+))?(-page-([0-9]+))?\.html$ $1/ivideo.php?tv=$3&ti=$5&tc=$7&page=$9 RewriteRule ^(.*)/ispecial(-tv-([0-9]+))?(-ti-([0-9]+))?(-tc-([0-9]+))?(-page-([0-9]+))?\.html$ $1/ispecial.php?tv=$3&ti=$5&tc=$7&page=$9 RewriteRule ^(.*)/icategory\.html$ $1/icategory.php RewriteRule ^(.*)/category-cid-([0-9]+)(-tag-([^-]*))?(-timelimit-([0-9]+))?(-orderlimit-([0-9]+))?(-page-([0-9]+))?\.html$ $1/category.php?cid=$2&tag=$4&timelimit=$6&orderlimit=$8&page=$10 RewriteRule ^(.*)/vspace-(mid|username)-(.+)\.html$ $1/vspace.php?$2=$3 RewriteRule ^(.*)/video-(vid|ivid)-(.+)\.html$ $1/video.php?$2=$3 RewriteRule ^(.*)/special-spid-([0-9]+)\.html$ $1/special.php?spid=$2

# 将 RewriteEngine 模式打开 RewriteEngine On # 修改以下语句中的 /SupeV 为你的播客目录地址,如果程序放在根目录中,请将 /SupeV 修改为 / RewriteBase /SupeV # Rewrite 系统规则请勿修改 RewriteRule RewriteRule ^ivideo(-tv-([0-9]+))?(-ti-([0-9]+))?(-tc-([0-9]+))?(-page-([0-9]+))?\.html$ ivideo.php?tv=$2&ti=$4&tc=$6&page=$8 RewriteRule ^ispecial(-tv-([0-9]+))?(-ti-([0-9]+))?(-tc-([0-9]+))?(-page-([0-9]+))?\.html$ ispecial.php?tv=$2&ti=$4&tc=$6&page=$8 RewriteRule ^icategory\.html$ icategory.php RewriteRule ^category-cid-([0-9]+)(-tag-([^-]*))?(-timelimit-([0-9]+))?(-orderlimit-([0-9]+))?(-page-([0-9]+))?\.html$ category.php?cid=$1&tag=$3&timelimit=$5&orderlimit=$7&page=$9 RewriteRule ^vspace-(mid|username)-(.+)\.html$ vspace.php?$1=$2 RewriteRule ^video-(vid|ivid)-(.+)\.html$ video.php?$1=$2 RewriteRule ^special-spid-([0-9]+)\.html$ special.php?spid=$1

UCHome1.0 规则

RewriteEngine On RewriteRule ^/(space|network)\-(.+)\.html$ /$1.php?Rewrite=$2 [L] RewriteRule ^/(space|network)\.html$ /$1.php [L] RewriteRule ^/([0-9]+)$ /space.php?uid=$1 [L]

RewriteEngine On RewriteBase / RewriteRule ^(space|network)\-(.+)\.html$ $1.php?Rewrite=$2 [L] RewriteRule ^(space|network)\.html$ $1.php [L] RewriteRule ^([0-9]+)$ space.php?uid=$1 [L]

UCHome2.0 规则

Apache 独立主机用户:# 修改以下语句中的 /uchome 修改为你的uchome目录地址,如果程序放在根目录中,请将 /uchome 修改为 /RewriteRule ^/(space|network)-(.+)\.html$ /$1\.php\?rewrite=$2 [L]RewriteRule ^/(space|network)\.html$ /$1\.php [L]RewriteRule ^/([0-9]+)$ /space\.php\?uid=$1 [L]

Apache 虚拟主机用户:

 # 将 RewriteEngine 模式打开RewriteEngine OnRewriteBase /03uchomeRewriteRule ^(space|network)\-(.+)\.html$ $1.php?rewrite=$2 [L] RewriteRule ^(space|network)\.html$ $1.php [L] RewriteRule ^([0-9]+)$ space.php?uid=$1 [L]

转自:

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


**本资源可免费获取,请至尾部读阅!**Discuz素材资源交易论坛整站源码,带数据整站源码打包。包含了导航、企业官网、企业建站、企业SEO等静态页面。论坛采用Discuz3.4,包含PC、手机主题。带30多款插件。站长亲测可以使用,不过还是需要稍微调整一下的,部分链接还是原站的绝对地址,不过这
分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!http://www.captainbed.netDiscuz!是腾讯(Tencent)旗下Comsenz公司推出的以社区为基础的专业建站平台,帮助网站实现一站式服务。让论坛(BBS)、个人空间(SNS)、门户(Portal)
最近工作需要IIS,自己的电脑又是Windows7系统,找了下安装的方法,已经安装成功。一、首先是安装IIS。打开控制面板,找到“程序与功能”,点进去二、点击左侧“打开或关闭Windows功能”三、找到“Internet信息服务”,按照下图打勾即可等待安装完成四、安装完成后,再回到控制面板
首先就是discuz,用起来真的是特别的好用,搭建的网站真的非常美观尤其是用起来之后,我发现功能真的是太强大了,不用到处编写代码,调试什么只需要把精力放在做产品上就可以了,我很好奇为什么会这么强大php的开源产品,比如wordpress也很强大,为什么discuz会如此的让我感到,是一种生态社区,而
1.找到图片路径拼装文件首先打开根目录下的template目录找到首页文件打开后找到图片列表的拼装位置//链接示例:<!--{eval$imagelistkey=getforumimg($pic[aid],0,300,500);}--><imgsrc="$imagelistkey"alt="$thread[subject]"/>然后修改为(客户要求改成缩略图)/
打开NavicatforMySQL找到数据表 pre_ucenter_members 把密码修改为123456789password:047099adb883dc19616dae0ef2adc5b6salt:311254改完就可以登录了:域名/admin.php记得上线后修改密码哦,嘿嘿嘿,鸡你太美!!!---------------------作者:Liu_Cabbage来源:CSDN原文:https://blog.
Discuz论坛基础搭建 第一步:下载XAMPP(Apache+Mysql+PHP+RERL)         下载的xampp-linux-x64-5.5.30-7-installer.run         上传到/home目录下,然后在命令行输入./xampp-linux-x64-5.5.30-7-installer.run,如果报权限问题,      
Discuz!是腾讯旗下Comsenz公司推出的以社区为基础的专业建站平台,帮助网站实现一站式服务。让论坛(BBS)、个人空间(SNS)、门户(Portal)、群组(Group)、应用开放平台(OpenPlatform)充分融合于一体,帮助网站实现一站式服务。Discuz!X3在继承和完善Discuz!X2.5的基础上,针对“系统架构”、
  Discuz迁移是一件较为麻烦的事情网上大多的迁移教程都是利用备份功能进行操作的,其实这种操作并不能保证迁移后完全正常工作本文将介绍直接转移数据库和文件的迁移方法 导出数据库迁移的首要部分就是导出数据库不论你是VPS、独立服务器还是虚拟主机一般都有phpmya
Discuz!论坛目前最新版本为3.4版本,已经好久没有更新了,我们SINE安全在对其网站安全检测的同时发现一处漏洞,该漏洞可导致论坛的后台文件可以任意的删除,导致网站瘫痪,后台无法登陆。关于该网站漏洞的细节我们来详细的分析看一下:Discuz漏洞的检测与分析该漏洞发生的位置在于source目录
  Discuz!X3.4升级后,帖子内容使用Unicode编码会出现直接显示源码问题打开:source\function\function_core.php  $string=str_replace(array('&','"','<','>'),array('&','"','<',&
安装discuz直接把安装包拷贝到根目录下然后在浏览器中输入http://localhost/myweb/install/index.php打开安装向导界面,需要修改一下myweb的权限安全属性uploading-image-555335.png把权限打开,然后一直下一步输入数据库的名称和密码adminroot******这步不成功可以看下
原文链接:http://www.cnblogs.com/bwzhangtao/p/4233362.html1<?php2/**3*抽奖4*@paramint$total5*/6functiongetReward($total=1000)7{8$win1=floor((0.12*$total)/100);9$win2=floor((3*$total)/100)
title:Linux搭建Discuz论坛WelcometoFofade'sBlog!这里是Linux搭建论坛的一些命令记录命令摘记:下载文件:Discuz安装环境:PHPApache2Mariadb(类MySQL)PHP-XML测试环境:浏览器查看tomcat页面是否正常,并简易编写一个PHP页面测试数据库操作:创建用户$createuser'name
原文链接:http://www.cnblogs.com/showblog/p/3358038.html取论坛指定版块帖子或回复(first=1就是帖子的1楼,如果=0就是调用回复,fid=62是论坛版块号):SELECT*FROMdiscuzx.pre_forum_postwherefirst=1andfid=62orderbytiddesc 取
LAMP平台概述目前最为成熟的一种企业网站应用模式,可提供动态Web站点应用及开发环境构成组件Linux、Apache、MySQL、PHP/Perl/PythonLAMP的优势成本低廉可定制、易于开发方便易用,安全和稳定一,在Windows上将LAMP所需压缩软件包共享出来(此处如有问题请看之前的博客相关文章)
代码functionlang($file,$langvar=null,$vars=array(),$default=null){echo$file.':'; global$_G; $fileinput=$file; list($path,$file)=explode('/',$file); if(!$file){echo('1-'); $file=$path; $path=
1、首先我们需要登录DZ论坛后台,在全局设置里边,关闭站点,防止网站出现新数据导致备份数据不完整。如图:2、找到站长板块,点击数据库,进行备份。3、按照提示,选择备份类型,点击提交开始进行备份。4、备份完成之后我们可以看到如下图。5、接下来我们需要把整个网站进行压缩打包。6、
实验目录:一、LAMP架构概念二、LAMP结构的安装与配置2-1手工编译安装http服务2-2手工编译安装mysql数据库2-3手工编译安装PHP工具三、安装Discuz论坛(开源论坛)四、小福利一、LAMP架构概念LAMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写:
  pre_common_admincp_cmenu后台菜单收藏表字段名数据类型默认值允许非空自动递增备注idsmallint(6)unsigned  NO是 titlevarchar(255)  NO  菜单名称urlvarchar(255)  NO  菜单地址sorttinyint(1) 0 NO  菜单类型,备用