Iis7.5+webconfig implement page pseudo-static and 301 redirect

Source: Internet
Author: User

Iis7.5+webconfig implement page pseudo-static and 301 redirect

Use the Urlrewriter component in Windows 2003 +iis 6.0 to configure the pseudo-static articles on the network in a large heap. However, in the iis7.0 or IIS 7.5 environment configuration of the site basically did not explain, even if there are some useless code snippet, today is very easy to configure the success, send a diary sharing experience.

Document Download: http://files.cnblogs.com/files/dunitian/IIS7.5_WebConfig%E5%AE%9E%E7%8E%B0%E9%A1%B5%E9%9D%A2%E4%BC%AA%E9% 9d%99%e6%80%81%e5%92%8c301%e9%87%8d%e5%ae%9a%e5%90%91.zip

    1. Download Urlrewriter Components ( dots ) First

Http://download.microsoft.com/download/0/4/6/0463611e-a3f9-490d-a08c-877a83b797cf/MSDNURLRewriting.msi

    1. To add a reference to a Urlrewriter assembly in a Web site project

    1. Configuring the Webconfig File

( 1 ) in <configuration> with the </configSections> node Intermediate settings:

<section name= "Rewriterconfig" type= "URLRewriter.Config.RewriterConfigSerializerSectionHandler, Urlrewriter"/ >

( 2 ) in the middle of and node settings:

<add name= "shtml" verb= "*" path= "*.shtml" type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>

<add name= "html" verb= "*" path= "*.html" type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>

( 3 ) in the middle of and node settings:

<add type= "Urlrewriter.modulerewriter, Urlrewriter" name= "Modulerewriter"/>

( 4 syntax for rule configuration:

in the <configuration> with the </configuration> join between <RewriterConfig></RewriterConfig> node.

in the <RewriterConfig> with the </RewriterConfig> To add a rule between:

<!--urlrewriter detailed configuration rules section starts -

<RewriterConfig>

<Rules>

<!-- pseudo-static configuration starts -

<!-- defining pseudo-static first rule Data Download Detail Page -

<RewriterRule>

<lookfor>^ (. *)/downloadshow/([0-9]+) \.shtml$</lookfor>

<SendTo>$1/Downloadshow/$2</SendTo>

</RewriterRule>

<!-- define pseudo-static second rule School Course Details Page -

<RewriterRule>

<lookfor>^ (. *)/s-coursedetail/([0-9]+) \.shtml$</lookfor>

<SendTo>$1/schoolsite/courseDetail/$2</SendTo>

</RewriterRule>

<!-- definition 301 Redirect The first rule Data Download Detail Page -

<RewriterRule>

<lookfor>^ (. *)/downdetail-([0-9]+) \.html$</lookfor>

<SendTo>$1/_301Deal/DownDetail/$2</SendTo>

</RewriterRule>

<!-- definition 301 REDIRECT second rule School Menu List Page -

<RewriterRule>

<lookfor>^ (. *)/xuexiao-(\w+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-\.html$</lookfor>

<SendTo>$1/_301Deal/SchoolList/$2-$3-$4-$5-$6-$7</SendTo>

</RewriterRule>

</Rules>

</RewriterConfig>

<!--urlrewriter detailed configuration rule section ends -

~~~ Wrap up ~ ~

Iis7.5+webconfig implement page pseudo-static and 301 redirection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.