LoginSignup
1
3

More than 5 years have passed since last update.

ASP.NETでURLを書き換える

Posted at

例えば、メンテナンス中のときなど、サイト上の全てのページへのアクセスを
ある特定のページへ飛ばしたい場合等に、
Web.configに変更を加えることで、URLを書き換えることができる。

URL書き換え方法

Web.configのsystem.webServerタグに以下の記述を追加する。

<rewrite>
    <rules>
        <rule name="sample">
            <match url="hoge.aspx" />
                <action url="Maintenance.aspx" type="Rewrite" />
        </rule>
    </rules>
</rewrite>

hoge.aspxの部分を.*とすれば、全てのページのURLがMaintenance.aspxへ書き換わる。

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3