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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[分享] 关于Win IIS非单一【品牌空间】站点开启伪静态需要注意的问题

[复制链接]
tiger_su 发表于 2010-8-11 15:58:03 | 显示全部楼层 |阅读模式
本帖最后由 tiger_su 于 2010-8-11 17:27 编辑

首先,必须确认一下你的站点(DZX)是否已经开启了Rewriter。如果开启了,那么你必须把DZX的规则与Brand的规则(这里是指httpd.ini文件)分别存于服务器的两个目录中,不能在同一个httpd.ini文件包含。
DiscuzX!  httpd.ini
  1. [ISAPI_Rewrite]

  2. # 3600 = 1 hour
  3. CacheClockRate 3600

  4. RepeatLimit 32
  5. #DXZ 规则开始
  6. # Protect httpd.ini and httpd.parse.errors files
  7. # from accessing through HTTP
  8. RewriteRule ^(.*)/topic-(.+)\.html\?*(.*)$ $1/portal\.php\?mod=topic&topic=$2&$3
  9. RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/portal\.php\?mod=view&aid=$2&page=$3&$4
  10. RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$4
  11. RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5
  12. RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=group&fid=$2&page=$3&$4
  13. RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/home\.php\?mod=space&$2=$3&$4
  14. RewriteRule ^(.*)/([a-z]+)-(.+)\.html\?*(.*)$ $1/$2\.php\?rewrite=$3&$4
  15. #Brand 规则开始
  16. RewriteRule ^(.*)/store-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2
  17. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3
  18. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3&xid=$4
  19. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)-catid-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3&catid=$4
  20. RewriteRule ^(.*)/street-([0-9]+)\.html\?*(.*)$ $1/street\.php\?catid=$2
  21. RewriteRule ^(.*)/street-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/street\.php\?catid=$2&tagid=$3
复制代码
Brand  httpd.ini
  1. [ISAPI_Rewrite]

  2. CacheClockRate 3600

  3. RepeatLimit 32

  4. RewriteRule ^(.*)/store-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2
  5. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3
  6. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3&xid=$4
  7. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)-catid-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3&catid=$4
  8. RewriteRule ^(.*)/street-([0-9]+)\.html\?*(.*)$ $1/street\.php\?catid=$2
  9. RewriteRule ^(.*)/street-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/street\.php\?catid=$2&tagid=$3
复制代码
请看我的设置和文件存放:

图片中的dzrewrite目录为DZX的伪静态httpd.ini及相关动态链接文件(dll)存放目录。
下面的Rewrite为Brand的伪静态httpd.ini及相关动态链接文件(dll)存放目录。

然后再打开WWW目录,把.htaccess文件分别上传到DZX论坛根目录和Brand网站根目录(注意:文件内容不是相同的)。

如下:
DiscuzX!
  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 ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2&%1
复制代码
Brand
  1. ###虚拟主机用户

  2. # 将 RewriteEngine 模式打开
  3. RewriteEngine On
  4. # 修改以下语句中的 /brand 为你的品牌空间目录相对地址,如果程序放在根目录中,请将 /brand 修改为 /
  5. RewriteBase /
  6. # Rewrite 系统规则请勿修改
  7. RewriteRule ^store-([0-9]+)\.html$ store.php?id=$1 [L,NC]
  8. RewriteRule ^store-([0-9]+)-([a-z]+)\.html$ store.php?id=$1&action=$2 [L,NC]
  9. RewriteRule ^store-([0-9]+)-([a-z]+)-([0-9]+)\.html$ store.php?id=$1&action=$2&xid=$3 [L,NC]
  10. RewriteRule ^store-([0-9]+)-([a-z]+)-catid-([0-9]+)\.html$ store.php?id=$1&action=$2&catid=$3 [L,NC]
  11. RewriteRule ^street-([0-9]+)\.html$ street.php?catid=$1 [L,NC]
  12. RewriteRule ^street-([0-9]+)-([0-9]+)\.html$ street.php?catid=$1&tagid=$2 [L,NC]

复制代码
购买虚拟主机的同学在做以上工作时需要空间商配合。如果是自己的服务器,你自己设置一下就好!!

切记:以上两个文件内容千万不能合为一个文件!!

本帖子中包含更多资源

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

x

评分

2

查看全部评分

 楼主| tiger_su 发表于 2010-8-11 15:59:49 | 显示全部楼层
本帖最后由 tiger_su 于 2012-2-25 21:40 编辑

经按一楼的方法设置后,我的品牌空间开启伪静态后,店铺不再提示未通过审核了!!

大家可以来观摩一下,并请提出宝贵意见!谢谢!!!

回复

使用道具 举报

cometj 发表于 2010-8-11 19:26:55 | 显示全部楼层
我没有成功,原因就是放在了一起!
回复

使用道具 举报

good114 发表于 2010-8-11 19:33:18 | 显示全部楼层
不错,这个要支持。
回复

使用道具 举报

 楼主| tiger_su 发表于 2010-8-11 20:03:22 | 显示全部楼层
不错,这个要支持。
good114 发表于 2010-8-11 19:33


谢谢!!
回复

使用道具 举报

cometj 发表于 2010-8-11 20:56:39 | 显示全部楼层
没有成功,打算不静态了,就那样了
回复

使用道具 举报

cometj 发表于 2010-8-12 11:19:18 | 显示全部楼层
目前还是测试阶段,等测试好了,再考虑静态!
回复

使用道具 举报

8#
无效楼层,该帖已经被删除
youpy 发表于 2010-8-30 01:53:41 | 显示全部楼层
没成功

然后再打开WWW目录,把.htaccess文件分别上传到DZX论坛根目录和Brand网站根目录(注意:文件内容不是相同的)。

IIS下也需要在网站根目录下放.htaccess文件?这个文件怎么命名?
回复

使用道具 举报

sissitang 发表于 2010-9-1 09:31:33 | 显示全部楼层
本帖最后由 sissitang 于 2010-9-1 09:43 编辑

Rewrite.ini已经放到单独的文件夹里,.htaccess也放到根目录,首页可以开,店铺页不行啊。求解呀。。。。

独立主机IIs。rewrite.ini如下:
  1. [ISAPI_Rewrite]

  2. CacheClockRate 3600

  3. RepeatLimit 32

  4. RewriteRule ^(.*)/store-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2
  5. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3
  6. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3&xid=$4
  7. RewriteRule ^(.*)/store-([0-9]+)-([a-z]+)-catid-([0-9]+)\.html\?*(.*)$ $1/store\.php\?id=$2&action=$3&catid=$4
  8. RewriteRule ^(.*)/street-([0-9]+)\.html\?*(.*)$ $1/street\.php\?catid=$2
  9. RewriteRule ^(.*)/street-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/street\.php\?catid=$2&tagid=$3
复制代码

.htaccess如下:
  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteRule (.*.css$|.*.js$|.*.jpg$) gzip.php?$1 [L]
  4. # Rewrite 系统规则请勿修改
  5. RewriteRule ^(.*/)*topic-(.+)\.html$ $1portal.php?mod=topic&topic=$2
  6. RewriteRule ^(.*/)*article-([0-9]+)\.html$ $1portal.php?mod=article&articleid=$2
  7. RewriteRule ^(.*/)*forum-([0-9]+)-([0-9]+)\.html$ $1forum.php?mod=forumdisplay&fid=$2&page=$3
  8. RewriteRule ^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3
  9. RewriteRule ^(.*/)*group-([0-9]+)-([0-9]+)\.html$ $1forum.php?mod=group&fid=$2&page=$3
  10. RewriteRule ^(.*/)*space-(username|uid)-(.+)\.html$ $1home.php?mod=space&$2=$3
  11. RewriteRule ^(.*/)*([a-z]+)-(.+)\.html$ $1$2.php?rewrite=$3
复制代码

回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-28 17:22 , Processed in 0.267491 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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