2016-04-22 8 views
0

私は/example/index.htmlというURLを持っています。ヒットすると、ページのルート/にリダイレクトする必要があります。asp.net web.configの404トリガーの前に特定のURLをリダイレクトします。

このページは実際には存在しないため、代わりに404が表示されます。 可能であれば、web.configファイルで実行します。これは私が持っているものです:

<location path="example/index.html"> 
    <system.webServer> 
    <httpRedirect enabled="true" destination="/" httpResponseStatus="Permanent" /> 
    </system.webServer> 
</location> 

しかし、404処理が最初にトリガされているようです。何か案は?

+0

mvcコントローラを使用していませんか? –

+0

@ KarthikMR私たちにはコントローラーがありますが、後でこれを変更したい場合は、コントローラーに追加する方が簡単です。 – ptf

+0

ロケーションタグを削除し、これを試してください -

答えて

0

system.webServerタグ内で使用します。その私の仕事:

<httpRedirect enabled="true" exactDestination="true"> 
    <add destination="/" wildcard="*/home/test.html" /> 
</httpRedirect> 
関連する問題