URL重写的正则表达式有谁知道怎么写 在网上找了几个 都不能用 
现在先用javascript来重写URL 以后估计会在IIS上做配置 
现在只要先做到类似:
http://localhost/carsprice/InsurancePrice_New_Index2.aspxCity=1&CarState=1&Price=52.5&Seat=5&Carage=1&Company=TPY&Date=2008-3-1
重写成 :http://localhost/carsprice/InsurancePrice_New_Index2/City/1/CarState/1/Price/52.5/Seat/5/Carage/1/Company/TPY/Date/2008-3-1/ 就可以了
请知道的朋友说下 很急啊 !!!!!  
谢谢 !!!!

解决方案 »

  1.   

    InsurancePrice_New_Index2/City/1/CarState/1/Price/52.5/Seat/5/Carage/1/Company/TPY/Date/2008-3-1/
    你能确保这些目录都存在 ?
    .aspx?  --> /&   ---> /=   --->  /
    js replace 就可以了
      

  2.   

    http://localhost/carsprice/InsurancePrice_New_Index2.asp?xCity=1&CarState=1&Price=52.5&Seat=5&Carage=1&Company=TPY&Date=2008-3-1 
    红色的?应该是有的吧?
      

  3.   

    str="http://localhost/carsprice/InsurancePrice_New_Index2.aspx?City=1&CarState=1&Price=52.5&Seat=5&Carage=1&Company=TPY&Date=2008-3-1 "
    //   http://localhost/carsprice/InsurancePrice_New_Index2/City/1/CarState/1/Price/52.5/Seat/5/Carage/1/Company/TPY/Date/2008-3-1/ 
    //str = str.replace(/[(.asp\?)=&]/,"/")
    str = str.replace(/[\?&](.*?)=(.*?)/g,"/$1/$2")
    document.write(str)
    str = str.replace(/(.*?)(\.aspx)(.*?)/g,"$1$3")
    document.write(str)
      

  4.   

    你能确保这些目录都存在 ? js重写不同iis重写,不存在的话就是404错误了
      

  5.   

    如果是在IIS中 配ISAPI_Rewirte 中RewriteRule该怎么写正则呢 我试用了很多网上的正则 但是都没有用 
    以后肯定还是要在IIS中来配置的 这样可以批量处理 而且不用考虑参数的因数 
      

  6.   

    将news.asp?id=234的映射成news/234.html时,只需设置: 
    RewriteRule /news/(\d+)\.html /news\.asp\?id=$1 [N,I] 
    这样就把 /news/234.html 这样的请求映射成了 /news.asp?id=234 
    当有对/news/234.html的请求时:web服务器会把实际请求转发给/news.asp?id=234 
    比对于某一个简单应用可以是:
    RewriteRule /news/(\d+)\.html /news/news\.php\?id=$1 [N,I] 
    这样就把 http://www.xxxxxx.com/news/234.html 映射到了 http://www.xxxxxx.com/news/news.php?id=234 
    一个更通用的能够将所有的动态页面进行参数映射的表达式是: 
    把 http://www.xxxxxx.cn/foo.php?a=A&b=B&c=C 
    表现成 http://www.xxxxxx.cn/foo.php/a/A/b/B/c/C 
    RewriteRule (.*?\.php)(\?[^/]*)?/([^/]*)/([^/]*)(.+?)? $1(?2$2&:\?)$3=$4?5$5: [N,I] 
    3、使用URL重写功能的好处:
    首先,有助于增加网站的安全性,因为它隐藏了诸如asp php jsp等相关的服务器技术,以最原始的html文件形式,呈现于客户。
    其次,在平台移植时,不会各页面的网站。如将news.asp?id=123转移news.php?id=123,即将asp平台转移php,如使用此URL重写,这个页面的网址就是news/123.html。
    其它方面,方便URL引用,有助于搜索引擎的枚举。
      

  7.   

    我在IIS里面的 ISAPI中配置了 RewriteRule (.*?\.php)(\?[^/]*)?/([^/]*)/([^/]*)(.+?)? $1(?2$2&:\?)$3=$4?5$5: [N,I]  但是不起作用 显示还是 http://localhost/carsprice/InsurancePrice_New_Index2.aspx?City=1&CarState=1&Price=48.7&Seat=5&Carage=1&Company=TPY&Date=2008-3-1 没有变化
      

  8.   

    str="http://localhost/carsprice/InsurancePrice_New_Index2.aspx?City=1&CarState=1&Price=52.5&Seat=5&Carage=1&Company=TPY&Date=2008-3-1 "
    //   http://localhost/carsprice/InsurancePrice_New_Index2/City/1/CarState/1/Price/52.5/Seat/5/Carage/1/Company/TPY/Date/2008-3-1/ 
    //str = str.replace(/[(.asp\?)=&]/,"/")
    str = str.replace(/[\?&](.*?)=(.*?)/g,"/$1/$2")
    document.write(str)
    str = str.replace(/(.*?)(\.aspx)(.*?)/g,"$1$3")
    document.write(str)
      

  9.   

    我现在在IIS中配置 ISAPI 但没有效果 
    我现在用了 Rewrit.dll 是根据网站上说的配的 但是没有效果 
    现在很迷茫  是否要修改httpd.ini文件?  
    或者那位知道如何配置IIS 有详细资料的给小弟我说下 感激不进啊 !!!!