分享

写回答

发帖

[提问] asp网站伪静态问题

回答|共 17 个

add.c

发表于 2010-7-15 15:26:31 | 显示全部楼层

回复 10# 的帖子

基本通用

chender

发表于 2010-7-15 15:37:26 | 显示全部楼层

找到了,在网站的根目录下有个httpd.ini的伪静态规则,要怎样才能转成web.config呢

下面这个是规则,谢谢帮忙看看



[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# WRMPS 6.2.0 Rewrite 规则

#城市分站
RewriteRule ^(.*)/city_([0-9]+)/$ $1/Index\.asp\?ConversionCity=$2
#简/完整版首页
RewriteRule ^(.*)/index_([0-9]+)/$ $1/Index\.asp\?Briefness=$2
#店铺
RewriteRule ^(.*)/co_([0-9]+)/$ $1/Co/Index\.asp\?ID=$2
#点评
RewriteRule ^(.*)/re_([0-9]+)_([0-9]+)/$ $1/Company/Critique/Index\.asp\?ComID=$2&Page=$3
#列表页,文章、信息、店铺、优惠券
RewriteRule ^(.*)/([\.a-zA-Z0-9]*)_([0-9]+)_([0-9]+)_([0-9]+)/$ $1/$2/Class\.asp\?ID=$3&Page=$4
#内容查看页
RewriteRule ^(.*)/([\.a-zA-Z0-9]*)_([a-z0-9A-Z]+)_([0-9]+)/$ $1/$2/Show\.asp\?ID=$3&Page=$4
#自助建站
RewriteRule ^(.*)/co/([0-9]+)/([a-zA-Z]+)_([0-9]+).html$ $1/co/$2/$3\.asp\?SID=$4
RewriteRule ^(.*)/co/([0-9]+)/([a-zA-Z]+)_list_([0-9]+)_([0-9]+).html$ $1/co/$2/$3\.asp\?sortid=$4&Page=$5

tianping88

发表于 2010-7-15 15:50:29 | 显示全部楼层

你照着对应的做就行了,没有测试行不行,大概就是这样,我只给你对应了一条,其它自己测试吧。
以下代码是在web.config里
<?xml version="1.0"?>
<configuration>  
  <system.web>
   
    <compilation debug="true">
    </compilation>
   
    <authentication mode="Windows"/>
   
    <customErrors mode="On" defaultRedirect="pageerror.html" >
      <error statusCode="403" redirect="pageerror.html" />
      <error statusCode="404" redirect="404.aspx" />
    </customErrors>
    <httpRuntime executionTimeout="30"/>
    <!--超时设置秒,记得debug设置为false-->
    <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="zh-CN"/>
   
  </system.web>
  <system.webServer>
    <rewrite>
      <rules>
        
        <rule name="city">
          <match url="^(.*)/city_([0-9]+)/$" />
          <action type="Rewrite" url="{R:1}/Index.asp?ConversionCity={R:2}" />
        </rule>
  
      
      </rules>
    </rewrite>
   
  </system.webServer>
</configuration>
红色部分为核心代码,如果有多个规则加多加红色部分,规则名不能同

[ 本帖最后由 tianping88 于 2010-7-15 03:51 PM 编辑 ]

评分

参与人数 1金币 +5 收起 理由
add.c + 5 助人为乐

查看全部评分

chender

发表于 2010-7-15 15:58:08 | 显示全部楼层

好的,非常感谢,我试试看

chender

发表于 2010-7-15 17:01:38 | 显示全部楼层

不行啊!我就拿上面这个源码用的话,暂不添加其它规则,就有问题,表现为,在首页点击其它不需要伪静态的栏目后,无法访问了,刷新也是一样的,显示错误。只有重新点击网址后的访问按钮,才能显示页面,我把红色的那几行代码删掉也是一样的。

还有就是帮我看看,我照你那个改的这几行能行吗?因为是菜鸟,实在不会改的,后面几个规则写不出啦!请大哥帮忙完善完善,不胜感激。

<rule name="index">
          <match url="^(.*)/index_([0-9]+)/$" />
          <action type="Rewrite" url="{R:1}/Index.asp?Briefness={R:2}" />
        </rule>
        
        <rule name="co">
          <match url="^(.*)/co_([0-9]+)/$" />
          <action type="Rewrite" url="{R:1}/co/Index.asp?ID={R:2}" />
        </rule>
        
        <rule name="re_([0-9]+)">
          <match url="^(.*)/re_([0-9]+)_([0-9]+)/$" />
          <action type="Rewrite" url="{R:1}/Company/Critique/Index.asp?ComID={R:2}" />
        </rule>
        
        <rule name="([\.a-zA-Z0-9]*)_([0-9]+)_([0-9]+)">
          <match url="^(.*)/([\.a-zA-Z0-9]*)_([0-9]+)_([0-9]+)_([0-9]+)/$" />
          <action type="Rewrite" url="{R:1}{R:2}/class.asp?ID={R:3}" />
        </rule>
        
        <rule name="([\.a-zA-Z0-9]*)_([a-z0-9A-Z]+)">
          <match url="^(.*)/([\.a-zA-Z0-9]*)_([a-z0-9A-Z]+)_([0-9]+)/$" />
          <action type="Rewrite" url="{R:1}{R:2}/Show.asp?ID={R:3}" />
        </rule>

sharesun

发表于 2010-7-15 19:13:48 | 显示全部楼层

你这个是目录形式的伪静态,可能需要设置404错误页面,然后再在错误页面里添加代码来显示相应内容。

weiti

发表于 2012-6-13 10:24:02 | 显示全部楼层

http://caifu.ccfoo.com/class.asp?lx=small&anid=38&nid=277  这个地址和怎么写伪静态 在线等
回复 支持 反对

使用道具 举报

S_Kingdom

发表于 2012-8-10 14:34:32 | 显示全部楼层

你好,你的问题解决了吗?我也遇到了伪静态问题,现在网站只有首页能打开,其他都是404错误,也没有在GD里配置web.config,后来你的怎么解决的呢?
回复 支持 反对

使用道具 举报

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

本版积分规则