Url redirection Summary

Source: Internet
Author: User

I am a little confused. So far, I have clicked on url redirection. I wrote a little simpler. I only wrote the steps and did not describe the principles!

Write as follows:
1.Go to the next file: MSDNURLRewriting. msi; used to extract URLRewriter. dll. After installing MSDNURLRewriting. msi locally, find URLRewriter. dll and copy it to any part of the website directory. I put it in the Bin. The url redirection is implemented based on this object.

2.You can configure the web. config file as follows:

First, add

<Section name = "RewriterConfig" type = "URLRewriter. Config. RewriterConfigSerializerSectionHandler, URLRewriter"/>

Remember to put this code at the top, otherwise it will be troublesome to have a problem.

Then add the following content under <configSections> in <configSections>.

<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor> ~ /(\ D {2}) \. html </LookFor>
<SendTo> ~ /New/new. aspx? Id = $1 </SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>

This is used to describe the redirection rule.

Finally, find

<Add verb = "*" path = "*. html"
Type = "URLRewriter. RewriterFactoryHandler, URLRewriter"/>
<Add verb = "*" path = "*"
Type = "URLRewriter. RewriterFactoryHandler, URLRewriter"/>

The location should not be reversed. It is best to put this code at the bottom of

<Add path = "WebResource. axd" verb = "GET" type = "System. Web. Handlers. AssemblyResourceLoader" validate = "True"/>

Then remember to add it, and add it to the top.

3.Back to the unfinished question.

<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor> ~ /(\ D {2}) \. html </LookFor>
<SendTo> ~ /New/new. aspx? Id = $1 </SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>

Inside

<LookFor> ~ /(\ D {2}) \. html </LookFor>
<SendTo> ~ /New/new. aspx? Id = $1 </SendTo>

Is used to write url rules, this article will not talk about, please look at this link, a look at it to understand http://hi.baidu.com/baixiaoxu/blog/item/6c278bf4b99ed42ebc31091f.html

4.After everything is done, it has been implemented, but remember to register the suffix of the url you want to redirect in iis. For example, you want to enter a url: to redirect DevilLife.html to a page, you must register the Suffix in iis :. html; the same applies to others. The registration process is as follows:

In iis, right-click the Properties dialog box and choose "home directory"> "configuration"> "add]

The suffix ". ax" is registered on the figure. If the suffix is the same for others, remember to remove the check mark "check whether the file exists". Otherwise, it will become invalid.

5.Okay. debug it.

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.