Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the absolute minimum content for web.config based url rewriting?

I'm going to be deploying an app in the near future on an IIS7 server, and would like to use the per-application URL rewriting settings in web.config, but this is not an ASP.NET application, so I have no need for anything superfluous.

What is the absolute minimum I need in my web.config in order to run my application and use URL Rewriting?

like image 208
Adam Tuttle Avatar asked Mar 18 '11 19:03

Adam Tuttle


People also ask

What is Web config how many Web config files can be allowed to use in an application?

There is no restriction to use the web. config file in the asp.net web application. You can have 1 Web. config file per folder .

What is rewrite URL in IIS?

About the URL Rewrite module The Microsoft URL Rewrite Module 2.0 for IIS 7 and above enables IIS administrators to create powerful customized rules to map request URLs to friendly URLs that are easier for users to remember and easier for search engines to find.

What is URL rewriting in asp net?

The concept of URL rewriting is simple. When a client sends a request to the Web server for a particular URL, the URL rewriting module analyzes the requested URL and changes it to a different URL on the same server.


1 Answers

After lots of googling and stumbling through various articles, I've found this article, which requires installing a URL Rewrite module (not packaged with IIS7). After that it's pretty simple.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule>
                    <match url="start\.html" />
                    <action type="Rewrite" url="finish.html" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

I was pretty surprised that an extra download was required -- I thought this functionality was supposed to be baked in (testing on Win7x64). Oh well, at least it works.

like image 75
Adam Tuttle Avatar answered Oct 20 '22 00:10

Adam Tuttle