0

私のサイトは html にあり、すべてのファイルは httpdocs ディレクトリに配置され、URL は次のようになります。

http://Mysite.com/httpdocs/test.html and i need to show
http://Mysite.com/test.html 

私のグーグルカスタム検索で。私は web.config で 301 リダイレクトを使用しました

<location path="httpdocs/test.html">
    <system.webServer>
      <httpRedirect enabled="true" destination="/test.html " exactDestination="true" childOnly="true" httpResponseStatus="Permanent" />
    </system.webServer>
</location>

約750のURLで機能しますが、1500のURLがあり、これはweb.configの制限を超えていると思いますので、最善の提案を教えてください。または、1行でルールを記述できる場合は問題ありません。

4

1 に答える 1

0

IIS 7.5 でアプリをホストし、 URL 書き換えモジュールをインストールできる場合、これは簡単に実行できます。

    <system.webServer>    
        <rewrite>
            <rule name="Stop" stopProcessing="true">
                <match url="^httpdocs/" />
                <action type="AbortRequest"/>
            </rule>
            <rule name="Rewrite">
                <match url=".*" />
                <action type="Rewrite" url="httpdocs/{R:0}" />
            </rule>
        </rewrite>    
    </system.webServer>
于 2012-11-02T10:36:06.930 に答える