1
ユーザーフレンドリーなURLを作成しようとしていますが、複数のルールが競合しているようです。iis urlユーザーフレンドリーなURLを書き直す複数のルールが矛盾しwokrsではない
私は好き、それを作成する必要があります。
www.example.com/destination/abc
www.example.com/river/cde
このコードで:
<rules>
<rule name="RedirectUserFriendlyURL3" stopProcessing="true">
<match url="^destination\.php$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^([^=&]+)=([^=&]+)$" />
</conditions>
<action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL3" stopProcessing="true">
<match url="^([^/]+)/([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="destination.php?{R:1}={R:2}" />
</rule>
<rule name="RedirectUserFriendlyURL4" stopProcessing="true">
<match url="^river\.php$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^([^=&]+)=([^=&]+)$" />
</conditions>
<action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL4" stopProcessing="true">
<match url="^([^/]+)/([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="river.php?{R:1}={R:2}" />
</rule>
</rules>
上記のルールが一緒に動作しませんし、両方のページが最初のルールに設定されています1にリダイレクトします。だから、私は$var is undefined
のエラーを受け取り、結果はページに表示されませんが、URLは異なります。
私は
www.example.com/destination/abc
www.example.com/river/cde
が必要しかし、何とかちょうど1つのルールにリダイレクトするように思えるこの結果を得ます。
してくださいすべてのフィードバックは、私は多くの同じ記事をチェックしますが、あなたのクエリはPHPのファイル名など
river.php?river=abc
とdestination.php?destination=abc
と同じであるならば、あなたのようなあなたのコードを変更することができます解決策に
ありがとうございます – Maria