2017-05-29 79 views

回答

0

下面的規則應該做的伎倆:

<rule name="teste_seo" stopProcessing="true"> 
    <match url="^script.asp" /> 
    <action type="Rewrite" url="/teste_seo/script.asp" /> 
</rule> 

然後,只需鏈接到www.mysite.com/script.asp

從OP評論後編輯:

如果因此只要您的文檔根目錄中有腳本文件的副本,就可以使用以下規則:

<rule name="teste_seo" stopProcessing="true"> 
    <match url="^teste_seo/([^\.]+\.asp)" /> 
    <action type="Redirect" url="/{R:1}" /> 
</rule> 

如果你需要的所有腳本文件指向同一個你可以使用:

<rule name="teste_seo" stopProcessing="true"> 
    <match url="^teste_seo/([^\.]+\.asp)" /> 
    <action type="Redirect" url="/script.asp" /> 
</rule> 

澄清之後再次編輯:

這條規則應該然後是修復,您需要:

<rule name="teste_seo_redirect" stopProcessing="true"> 
    <match url="^teste_seo/([^\.]+\.asp)" /> 
    <action type="Redirect" url="/{R:1}" /> 
</rule> 
<rule name="teste_seo_rewrite" stopProcessing="true"> 
    <match url="^([^\.]+\.asp)" /> 
    <action type="Rewrite" url="/teste_seo/{R:1}" /> 
</rule> 
+0

Hi Siggi2k! TKS!對不起,但我忘了寫我需要teste_seo文件夾內的任何* .asp文件。從abc.asp到xyz.asp。 – Ailton

+0

您是否需要teste_seo文件夾中的所有腳本才能在根級別上工作? 您是否需要www.mysite.com/teste_seo/script.asp指向www.mysite.com/script.asp,然後www.mysite.com/teste_seo/another-script.asp指向www.mysite。 COM /另一-script.asp? 我用我認爲會幫助你的代碼編輯我的原始答案,所以如果這能解決你的問題,請將其標記爲答案。 – Siggi2k

+0

是的,你是對的。但是,我需要將根文件夾中的teste_seo文件夾中的所有文件的副本?你說「只要你有一份根目錄下的腳本文件的副本」 – Ailton