[提问]
斑竹求救关于web.config冲突问题
|
|
本帖最后由 gotoplay 于 2012-7-19 10:08 AM 编辑
GOdaddy空间 Hosting Windows 150G
空间主域名:www.yingwww.com
网站是Discuz! X2.5的
在根目录配置了web.config文件 伪静态与301 内容是:红色的代码是301
----------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WWW Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^yingwww.com$" />
</conditions>
<action type="Redirect" url="http://www.yingwww.com/{R:0}"
redirectType="Permanent" />
</rule>
<rule name="topic">
<match url="^topic-(.+)\.html$" />
<action type="Rewrite" url="portal.php?mod=topic&topic={R:1}" />
</rule>
<rule name="article">
<match url="article-([0-9]+)\.html$" />
<action type="Rewrite" url="portal.php?mod=view&aid={R:1}" />
</rule>
<rule name="forum">
<match url="^forum-([0-9]+)-([0-9]+)\.html$" ignoreCase="false" />
<action type="Rewrite" url="forum.php?mod=forumdisplay&fid={R:1}&page={R:2}" appendQueryString="false" />
</rule>
<rule name="thread">
<match url="^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$" />
<action type="Rewrite" url="forum.php?mod=viewthread&tid={R:1}&extra=page={R:2}&page={R:3}" />
</rule>
<rule name="group">
<match url="^group-([0-9]+)-([0-9]+)\.html$" />
<action type="Rewrite" url="forum.php?mod=group&fid={R:1}&page={R:2}" />
</rule>
<rule name="space">
<match url="^space-(username|uid)-(.+)\.html$" />
<action type="Rewrite" url="home.php?mod=space&{R:1}={R:2}" />
</rule>
<rule name="Xrewrite">
<match url="^([a-z]+)-(.+)\.html$" />
<action type="Rewrite" url="{R:1}.php?rewrite={R:2}" />
</rule>
</rules>
</rewrite>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
</system.webServer>
<system.web>
<customErrors mode="Off" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" />
</system.web>
</configuration>
-----------------------------------------------------------------------------------------------------------------------------------
子目录下的网站web.config也是一模一样配置的 问题出现了:
主域名一切正常 子目录底下的所有网站全部出现 HTTP Error 500.50 - URL Rewrite Module Error. 错误
版主跟大家都帮我看看问题出在哪里了 谢谢 !
如果我把根目录的web.config删除,子目录下的所有网站访问正常! 加上web.config子目录下的所有网站访问错误! 问题关键在哪里?
我如果把
<rule name="WWW Redirect" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^yingwww.com$" />
</conditions>
<action type="Redirect" url="http://www.yingwww.com/{R:0}"
redirectType="Permanent" />
</rule>
301代码去掉 页面HTTP状态查询 主站 返回状态码:302
子目录下的所有网站访问还是错误 提示不同:
Config Source
13: </rule>
14: <rule name="topic">
15: <match url="^topic-(.+)\.html$" />
|
|
|
|
|
|
|
|
|
|
|
nisheng
发表于 2012-7-19 11:04:11
|
显示全部楼层
gotoplay 发表于 2012-7-19 10:56 AM 
按照这个帖子设置 出现500错误
那就不要这样设置了,godaddy子域名设置伪静态不好实现 |
|
|
|
|
|
|
|
|
|
|
nisheng
发表于 2012-7-19 10:46:55
|
显示全部楼层
gotoplay 发表于 2012-7-19 10:40 AM 
你的意思是 子目录不要加web.config了? 还是说跟目录的web.config可以决定子目录域名? ...
子目录可以不要web.config,一般在根目录webconfig中设置就可以了,当然决定子目录和根目录的代码会有所不同的。 另外关于子目录的伪静态设置可以在web.config里面设置,不过不容易实现,相关的代码你可以找找,我对代码懂得不多,然后你可以参考下这个帖子:http://bbs.idcspy.com/thread-319526-1-1.html,在配置文件中添加下试试,当然也有可能不行。 |
|
|
|
|
|
|
|
|
|
|
20111208sbd
发表于 2012-7-19 10:47:59
|
显示全部楼层
本帖最后由 20111208sbd 于 2012-7-19 11:01 AM 编辑
gotoplay 发表于 2012-7-19 10:44 AM 
按照你说的 我去掉了 WWW 但是还是提示错误 就是第二张图的错误
Config Source
这说明你的301和伪静态都有问题 |
|
|
|
|
|
|
|
|
|
|
gotoplay
发表于 2012-7-19 10:56:28
|
显示全部楼层
nisheng 发表于 2012-7-19 10:46 AM 
子目录可以不要web.config,一般在根目录webconfig中设置就可以了,当然决定子目录和根目录的代码会有所 ...
按照这个帖子设置 出现500错误 |
|
|
|
|
|
|
|
|
|
|
暮木娃娃
发表于 2012-7-19 10:26:07
|
显示全部楼层
gotoplay 发表于 2012-7-19 10:22 AM 
娃娃!谢谢 是子目录下的web.config 还是根目录下的呢?
伪静态代码
先将根目录下的确定没有问题,再测试子目录下的伪静态
最好用程序官方提供的代码 |
|
|
|
|
|
|
|
|
|
|
20111208sbd
发表于 2012-7-19 10:26:20
|
显示全部楼层
gotoplay 发表于 2012-7-19 10:10 AM 
我是想主域名跟子目录下的所有网站都实现伪静态与301 功能 所以在根目录与子目录下都全部放置了一模一样 ...
你在根目录下和子目录下的配置文件中放置的301规则是一模一样的,没有修改吗?,同一个url既重定向到根目录又重定向到子目录,当然会出错了。 |
|
|
|
|
|
|
|
|
|
|
gotoplay
发表于 2012-7-19 10:28:36
|
显示全部楼层
20111208sbd 发表于 2012-7-19 10:26 AM 
你在根目录下和子目录下的配置文件中放置的301规则是一模一样的,没有修改吗?,同一个url既重定向到根目 ...
301中的规则除了修改网址 其他都不变 url有修改 |
|
|
|
|
|
|
|
|
|
|
gotoplay
发表于 2012-7-19 10:33:48
|
显示全部楼层
|
如果我删除根目录下的 web.config 子目录下所有网站都能正常 如果根目录下加web.config 则主域名一切正常 子目录所有网站 出现错误! |
|
|
|
|
|
|
|
|
|
|
20111208sbd
发表于 2012-7-19 10:36:50
|
显示全部楼层
|
看你第一张图片上的错误提示是不能将name设置为www的,应该是重复了吧 |
|
|
|
|
|
|
|
|