2012-12-19 64 views
0

重新書寫這是我想要使用的web.config實現(我目前的web.config用於強制非www,這將仍然是必要的)URL使用web.confg

該網站是首先託管在一個子文件夾下,我們現在將其移至根目錄。這是我現在想要實現的:

舊網址示例:mysite.com/subfolder/prodView.asp?idproduct=1312 & idCategory = 44應該重定向到mysite.com/prodView.asp?idproduct= 1312 & idCategory = 44(我們必須擺脫舊的子文件夾)

這將需要儘可能多的客戶已經保存的產品在他們的瀏覽器鏈接,也是我們公佈1000年對Twitter和Facebook鏈接全都包括內的子文件夾。

任何幫助將不勝感激。

Current web.config 
<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<system.webServer> 
<rewrite> 
<rules> 
<rule name="Remove WWW prefix" stopProcessing="false"> 
<match url="(.*)" ignoreCase="true" /> 
<conditions> 
<add input="{HTTP_HOST}" pattern="^www\.mysite\.com$" /> 
</conditions> 
<action type="Redirect" url="http://mysite.com/{R:1}" redirectType="Permanent" /> 
</rule> 
</rules> 
</rewrite> 
</system.webServer> 
</configuration> 

回答

0

添加下面的規則到現有規則(S):

<rule name="Redirect old subfolder links" stopProcessing="false"> 
    <match url="^subfolder/(.+)" ignoreCase="true" /> 
    <action type="Redirect" url="/{R:1}" appendQueryString="true" redirectType="Permanent" /> 
</rule>