2013-04-05 126 views
0

我在IIS上配置了一個網站,並在我的hosts文件上配置了多個指向我本地主機的域。IIS - 將所有請求從一個域重定向到特定文件夾

我的問題是我需要的所有請求重定向來自: http://domain.com/folder/http://domain.com/

所以對於 http://domain.com/folder/test/image.jpeg的請求應轉變爲: http://domain.com/test/image.jpeg

我無法改變,因爲這些文件我試圖模仿一個CDN行爲。

任何人都可以幫忙嗎?

感謝 若昂

回答

2

使用rewrite module,你可以去:

<rule name="skip folder" stopProcessing="true"> 
    <match url="^folder/(.*)$" /> 
    <action type="Redirect" url="{R:1}" /> 
</rule> 

默認重定向是永久性的(301)。
如果你想保持網址http://domain.com/folder/test/image.jpeg但顯示的內容http://domain.com/test/image.jpeg,然後重寫,必須使用:

<rule name="skip folder" stopProcessing="true"> 
    <match url="^folder/(.*)$" /> 
    <action type="Rewrite" url="{R:1}" /> 
</rule> 
+0

感謝的人。有效 – jribeiro 2013-04-06 17:35:37

相關問題