0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

WebMatrix(ASP.NET Web ページ) で URL を書き換える

Posted at

ASP.NET の作法がそのまま利用できます。

たとえば、http://sample.com/ にある Web アプリケーションで

http://sample.com/Pages.cshtml/Hoge
http://sample.com/Pages/Hoge

http://sample.com/Hoge

に飛ばしたい場合、Web.config へ以下のように記述します。

Web.confug
<?xml version="1.0"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Daruboard" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions>
                         <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="Pages.cshtml/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?