分享

写回答

发帖

[提问] 我要疯了,win主机 .htaccess 转 web.config

GoDaddy GoDaddy 1660 人阅读 | 4 人回复

发表于 2011-6-3 10:17:32 | 显示全部楼层 |阅读模式

搞了好长时间了
大家帮我看看什么地方出错了
.htaccess的源代码:
ErrorDocument 404 /index.php?m=error
RewriteEngine on
RewriteRule ^index.html$                                 /index.php [L]
RewriteRule ^([a-zA-Z0-9_]+)\.html$                         /index.php?m=$1 [L]
RewriteRule ^weather-([0-9]+)-([0-9]+)\.html$                 /index.php\?m=weather&cityid=$1&xid=$2 [L]

RewriteRule ^news-c([0-9]+)-([0-9]+)\.html$                 /index.php\?m=news&class_id=$1&page=$2 [L]
RewriteRule ^news-c([0-9]+)\.html$                         /index.php\?m=news&class_id=$1 [L]
RewriteRule ^newsinfo-([0-9]+)\.html$                         /index.php\?m=newsinfo&aid=$1 [L]

RewriteRule ^liansuo-([0-9]+)-([0-9]+)\.html$                 /index.php\?m=liansuohotel&cityid=$1&chain_id=$2 [L]
RewriteRule ^liansuo-([a-zA-Z_]+)-([0-9]+)\.html$         /index.php\?m=liansuohotel&$1=$2 [L]

RewriteRule ^city-([0-9]+)\.html$                         /index.php\?m=city&cityid=$1 [L]

RewriteRule ^hotel-([0-9]+)-([0-9]+)\.html$                 /index.php\?m=hotelinfo&cityid=$1&hotel_id=$2 [L]
RewriteRule ^hotel-([0-9]+)\.html$                         /index.php\?m=hotelinfo&hotel_id=$1 [L]
RewriteRule ^(hotelmap|hotelcomment|hotelnearby|hotelpicture|hotelquestion|hotellable)-([0-9]+)\.html$        /index.php\?m=$1&hotel_id=$2 [L]

RewriteRule ^(comment|question|weather|searchlist)-([0-9]+)-([0-9]+)\.html$         /index.php\?m=$1&cityid=$2&page=$3 [L]
RewriteRule ^hotellist-([0-9]+)\.html?([\w%]*)$                 /index.php\?m=hotellist&cityid=$1&$2 [QSA,L]
RewriteRule ^(comment|question|weather|map|hotellist|searchlist)-([0-9]+)\.html$         /index.php\?m=$1&cityid=$2 [L]

RewriteRule ^lable-cityid([0-9]+)-([0-9]+)-([0-9]+)\.html$        /index.php\?m=lable&cityid=$1&classid=$2&page=$3 [L]
RewriteRule ^lable-(pid|cityid)([0-9]+)-([0-9]*)\.html$         /index.php\?m=lable&$1=$2&classid=$3 [L]
RewriteRule ^lable-([0-9]+)\.html$                                /index.php\?m=lable&classid=$1 [L]

RewriteRule ^admin$                 /index.php\?m=admin [L]


以下是我修改的web.config ,上传后是500错误,不知道什么地方写错了,请高手帮助。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
<rewrite>
        <rule name="Rewrite to index">
                <match url="^index.html$" />
                <action type="Rewrite" url="/index.php" />
        </rule>
        <rule name="Rewrite to azindex">
                <match url="^([a-zA-Z0-9_]+)\.html$" />
                <action type="Rewrite" url="/index.php?m={R:1}" />
        </rule>
        <rule name="Rewrite to weather">
                <match url="^weather-([0-9]+)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=weather&cityid={R:1}&xid={R:2}" />
        </rule>
        <rule name="Rewrite to news">
                <match url="^news-c([0-9]+)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=news&class_id={R:1}&page={R:2}" />
        </rule>
        <rule name="Rewrite to news-c">
                <match url="^news-c([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=news&class_id={R:1}" />
        </rule>
        <rule name="Rewrite to newsinfo">
                <match url="^newsinfo-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=newsinfo&aid={R:1}" />
        </rule>
        <rule name="Rewrite to liansuo">
                <match url="^liansuo-([0-9]+)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=liansuohotel&cityid={R:1}&chain_id={R:2}" />
        </rule>
        <rule name="Rewrite to liansuohotel">
                <match url="^liansuo-([a-zA-Z_]+)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=liansuohotel&{R:1}={R:2}" />
        </rule>
        <rule name="Rewrite to city">
                <match url="^city-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=city&cityid={R:1}" />
        </rule>
        <rule name="Rewrite to hotel">
                <match url="^hotel-([0-9]+)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=hotelinfo&cityid={R:1}&hotel_id={R:2}" />
        </rule>
        <rule name="Rewrite to hotelinfo">
                <match url="^hotel-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=hotelinfo&hotel_id={R:1}" />
        </rule>
        <rule name="Rewrite to hotel_id">
                <match url="^(hotelmap|hotelcomment|hotelnearby|hotelpicture|hotelquestion|hotellable)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m={R:1}&hotel_id={R:2}" />
        </rule>
        <rule name="Rewrite to list">
                <match url="^(comment|question|weather|searchlist)-([0-9]+)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m={R:1}&cityid={R:2}&page={R:3}" />
        </rule>
        <rule name="Rewrite to QS">
                <match url="^hotellist-([0-9]+)\.html?([\w%]*)$" />
                <action type="Rewrite" url="/index.php\?m=hotellist&cityid={R:1}&{R:2}" />
        </rule>
        <rule name="Rewrite to alllist">
                <match url="^(comment|question|weather|map|hotellist|searchlist)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m={R:1}&cityid={R:2}" />
        </rule>
        <rule name="Rewrite to lable">
                <match url="^lable-cityid([0-9]+)-([0-9]+)-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=lable&cityid={R:1}&classid={R:2}&page={R:3}" />
        </rule>
        <rule name="Rewrite to lableid">
                <match url="^lable-(pid|cityid)([0-9]+)-([0-9]*)\.html$" />
                <action type="Rewrite" url="/index.php\?m=lable&{R:1}={R:2}&classid={R:3}" />
        </rule>
        <rule name="Rewrite to lables">
                <match url="^lable-([0-9]+)\.html$" />
                <action type="Rewrite" url="/index.php\?m=lable&classid={R:1}" />
        </rule>
</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>

回答|共 4 个

lwbo1987

发表于 2011-6-3 10:23:24 | 显示全部楼层

楼主是要设置什么,伪静态还是什么,程序是什么?discuz吗
回复 支持 反对

使用道具 举报

南华

发表于 2011-6-3 10:25:32 | 显示全部楼层

我要设置伪静态,程序是qunaer的cms
回复 支持 反对

使用道具 举报

lwbo1987

发表于 2011-6-3 10:29:27 | 显示全部楼层

看看此贴希望对你有帮助http://bbs.idcspy.com/thread-97677-1-1.html
回复 支持 反对

使用道具 举报

hubo713

发表于 2011-6-3 15:12:20 | 显示全部楼层

<match url="^index.html$" />
                <action type="Rewrite" url="/index.php" />
index.php前面多了"/"吧
回复 支持 反对

使用道具 举报

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

本版积分规则