2011-12-22 100 views
1

我想重写使用web.config的URL,但我不知道它,所以你会帮我吗?下面是我的web.config代码:使用web.config URL重写

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
       <rule name="xyz" patternSyntax="Wildcard"> 
        <match url="*"/> 
         <conditions> 
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> 
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> 
         </conditions> 
        <action type="Rewrite" url="index.php"/> 
       </rule></rules> 
    </rewrite> 
    </system.webServer> 
</configuration> 

我有一个像网址:http://www.example.com/?file_name=manage_test

我想这是这样的:http://www.example.com/manage_testhttp://www.example.com/manage_test.html

我怎么能执行此操作?

在此先感谢。

回答

0

该重写规则将做到这一点重写你:

<rule name="xyz" stopProcessing="true"> 
    <match url=".*" /> 
    <conditions> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
    </conditions> 
    <action type="Rewrite" url="index.php?file_name={R:0}" /> 
</rule> 

此网址http://www.example.com/manage_test将被改写,以http://www.example.com/?file_name=manage_test