Configure Urlrewriter.net for IIS7 November 5th, 2009
UrlRewriter.NET is an open-source, light-weight, highly configurable URL rewriting component for ASP.NET 1.1 and 2.0.It is a great Search Engine Optimization (SEO) tool. Using UrlRewriter.NET, you can create URL’s containing your target keywords, boosting your rankings.
It’s not complicated for you to configure Urlrewriter.net on IIS7.Here’s a few simply steps for you to make it.
1.Add a reference to the Intelligencia.UrlRewriter assembly. To do this, right-click the root entry of your project in Solution Explorer , and choose Add Reference... In the dialog that opens, click the Browse tab, and browse to UrlRewriterV2\bin\Release\Intelligencia.UrlRewriter.dll. Select the file and click OK.
2.Open your web.config file in your web project and add the following configuration section handler that
enables UrlRewriter.NET to read its configuration from a configuration node named rewriter:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="rewriter" requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.
RewriterConfigurationSectionHandler,Intelligencia.UrlRewriter" />
</configSections>
Ensure that The element is the first child of the element.
3.Now configure the UrlRewriter HTTP module, which allows UrlRewriter.NET to intercept incoming requests
(and rewrite them):
<system.web>
...
<httpModules>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule,
Intelligencia.UrlRewriter" name="UrlRewriter" />
</httpModules>
...
4.Finally, we must make sure UrlRewriter.NET is configured to receive all requests to nonexistent files or
folders. Course of using iis7,you need to add the following lines to your web.config
file:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter. ➥
RewriterHttpModule" />
</modules>
…
5.Excellent, now UrlRewriter.NET is ready to use!Now you can configure url rewriting for you application by add the highlighted configuration
elements in the section of web.config:
<configuration>
<configSections>
...
</configSections>
<rewriter>
<rewrite url="/my-super-product.aspx" to="~/Product.aspx?ProductID=1" />
</rewriter>
...
Via step 5 you’ll know that you’ll add the real URL rewriting rules for your pages between element "<rewriter>".
Hi Zhiqun,
I have been searching for the solution to make urlrewriter.net work on IIS7 for one of my websites. I saw your article on this, tried, but still no luck. My database is already running at the production server, hence I only did the "add reference" for the database in my PC and not the actual one. Is it the reason why it did not work on the production database? (Note: I had already uploaded the relevant urlrewriter.net files to the production server). Hope that you can help to shed some lights into my problem. Thanks in advance.
Hello Tada,I'm sorry about your problem.I hadn't ever add a reference of a assembly thought the database.Maybe it won't work on the production database.Try to add a reference of urlrewriter.net on the disk file system. And make sure the relevant urlrewriter.net files (include Intelligencia.UrlRewriter.dll and Intelligencia.UrlRewriter.xml) stay in the Bin Directory of your Website Solution Explorer.Good Luck!