想问一下各位高手,因为目前项目是java写的,已经编写完毕但是考虑到安全性,要将jsp后缀的url重写成html,htm在网上查了之后 看到了用urlrewrite技术的话需要配置
<rule>  
  
              <from>/(.*).html</from>  
  
              <to>index.jsp?id=$1</to>  
  
       </rule>  但如果考虑的页面很多 , 那不是需要一个个配置吗?有没有统一配置的方法?nginx,有朋友说很方便,我在网上查了后也不是很详细,用这个方便吗?有朋友用过吗?

解决方案 »

  1.   

    <rule>  
      
      <from>/(.*).html</from>  
      
      <to>index.jsp?id=$1</to>  
      
      </rule>   这个不方便吗? 用了正则表达来匹配页面呀。不过你怎么好像写反了。
    <rule>  
      
      <from>/(.*).jsp(.*)</from>  
      
      <to>/$1.html</to>  
      
    </rule>   
      

  2.   

    好像没反噢,我又搜索了一下,网上都这么写的。但是按照他们的写法 就有一个问题了,每个页面都要配置对应的页面<urlrewrite>    
        <rule>    
            <from>^/([a-z]+)$</from>    
            <to type= "forward" >/world.jsp?id=$1</to>    
        </rule>    
        <rule>  
            <from>^/world/(.*)$</from>  
            <to>/world.jsp?tid=$1</to>  
        </rule>  
        <rule>  
            <from>^/(.*).html$</from>  
            <to>/test1/$1.jsp</to>  
        </rule>  
           
        <outbound-rule>    
            <note>    
            The outbound-rule specifies that when response.encodeURL is called (if you are using JSTL c:url)    
            the url /rewrite-status will be rewritten to /test/status/.    
               
            The above rule and this outbound-rule means that end users should never see the    
            url /rewrite-status only /test/status/ both in thier location bar and in hyperlinks    
            in your pages.    
            </note>    
            <from>/rewrite-status</from>    
            <to>/test/status/</to>    
        </outbound-rule>  
    </urlrewrite>   
      

  3.   

    最后是如何解决的啊?是需要不同格式的url都要映射一遍嘛