Benefits and methods of asp. net url rewrite

  • 2020-06-01 09:36:54
  • OfStack

Benefits of url rewrite:

1. It is easy for search engines to retrieve (the website in html format has the highest priority for search engines to remember, and seo is better optimized)

2. url is more concise and convenient for users to remember

3, hide the actual road strength of the web page and specific development technology

Rewrite using URLRewriter.dll

After using URLRewriter.dll, you can override url by simply using the following steps

1, write under webconfig


<Rules>  
     <!--  The rules 1 -->  
     <RewriterRule>  
       <LookFor>~/d(\d+)\.html </LookFor>  
       <SendTo>~/default.aspx?id=$1 </SendTo>  
     </RewriterRule>  
   </Rules> 

The page is ~/ default.aspx? id=5, automatically or converted to ~/ d5.html, but with regular constraints

2, the configuration httpmodel


<httpModules>  
      <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />  
    </httpModules> 

Windows2003 server configuration:
Web site - > Property - > Directory - > Configuration (G) - > Map - > Wildcard application mapping - > insert
Executable file: C:\WINDOWS\ Microsoft.NET \Framework\ v2.0.50727 \ aspnet_isapi.dll
Verify file exists: not selected


Related articles: