0

IIS7 の ASP.NET 4.0 で使用している書き換えルールがあります。

<system.webServer>
<rewrite>
  <rules>
    <rule name="Rewrite default to aspx" stopProcessing="true">
      <match url="^$" ignoreCase="false" />
      <action type="Rewrite" url="home.aspx" />
    </rule>
  </rules>
</rewrite>
<defaultDocument>
  <files>
    <add value="home.aspx" />
  </files>
</defaultDocument>
</system.webServer>

このルールは (http://example.com/aboutus.aspx) を取り、URL の末尾から .aspx を削除します。サブドメイン (http://www.example.com/blog) にインストールされている wordpress で問題が発生しています。書き換えルールが原因で、次のエラーが表示されます。

説明: HTTP 404。探しているリソース (またはその依存関係の 1 つ) は、削除されたか、名前が変更されたか、一時的に利用できない可能性があります。次の URL を見直して、スペルが正しいことを確認してください。

要求された URL: /blog/.aspx

安全に ( http://www.example.com/blog/ ) に到達し、最後に .aspx を追加しないように URL 書き換えルールを修正する方法を知っている人はいますか?

ブログのサブディレクトリを検索してディレクトリ「/blog/」を無視できる構文はありますか?

大歓迎です!ありがとうございました!:)

4

1 に答える 1

0

ルールを 1 つを除くすべての URL に適用する/blog/*場合は、negate オプションを使用できます。

<rule name="Rewrite default to aspx" stopProcessing="true">
  <match url="^blog/" ignoreCase="false" negate="true" />
  <action type="Rewrite" url="home.aspx" />
</rule>

http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference#Rule_pattern_properties

于 2013-02-10T23:45:25.957 に答える