2013-02-18 145 views
2

我從阿帕奇遷移到IIS,我面臨着URL重寫的問題。IIS 7.5重寫友好的URL發出

我想這樣所有的請求:

http://192.168.0.44/aaa/bbb/ccc/testword 

查詢這不是友好的網址:

http://192.168.0.44/aaa/bbb/ccc/index.php?word=testword 

所以我的web.config是:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <rule name="RewriteUserFriendlyURL1" stopProcessing="true"> 
        <match url="^192\.168\.0\.44/aaa/bbb/ccc/([^/]+)/?$" /> 
        <conditions> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
        </conditions> 
        <action type="Rewrite" url="192.168.0.44/aaa/bbb/ccc/index.php?word={R:1}" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 

但是當我訪問這樣一個URL,我得到一個404沒有找到錯誤。詳情:

Module IIS Web Core 
Notification MapRequestHandler 
Handler StaticFile 
Error Code 0x80070002 

Requested URL http://192.168.0.44:80/aaa/bbb/ccc/testword 
Physical Path C:\inetpub\wwwroot\aaa\bbb\ccc\testword 
Logon Method Anonymous 
Logon User Anonymous 

我做錯了什麼?

p.s.會有一個域名了,而不是知識產權,它只是我想先在本地測試我做直播前。

重寫模塊2安裝。我可以在iis經理gui看到。

在此先感謝。

+0

請關閉,它解決了 – MIrrorMirror 2013-02-18 14:29:29

+0

它甚至更好,如果你可以發表你的解決方案作爲一個答案,並接受它。 – cheesemacfly 2013-02-18 15:12:02

回答

1

我刪除了這是在頂層,並實現了它在它的最簡單的方法(不長的路徑和IP)中最深的文件夾(CCC)這個重寫規則。它自動工作。