Ii. Use urlrewriter. net

Source: Internet
Author: User

Urlrewriter. NET is an open-source URL address rewriting component whose rewriting is implemented at the ASP. NET level, rather than the IIS level.

First, we need to download the urlrewriter. net installation package, and then decompress it to the local.

2. Reference intelligencia. urlrewriter. dll in.

3. Configure web. config so that urlrewriter. Net can read the configuration from the configuration node named rewriter:

<? XML version = "1.0"?>

<Configuration>
<Configsections>
<Section name = "rewriter" restartonexternalchanges = "false" type = "intelligencia. urlrewriter. configuration. rewriterconfigurationsectionhandler, intelligencia. urlrewriter"/>
</Configsections>

Note: The configsetctions unit must be the first sub-unit of the Configuration unit.

4. Now configure the urlrewriter HTTP module to allow urlrewriter. Net to intercept incoming requests (and rewrite them)

<System. Web>

<Httpmodules>
<Add type = "intelligencia. urlrewriter. rewriterhttpmodule, intelligencia. urlrewriter" name = "urlrewriter"/>
</Httpmodules>

5. Now urlrewriter. NET is ready to work, and the next request facing/my-super-product.aspx is rewritten to/product. aspx? Productid = 123. Add the following highlighted configuration units in the <configuration> section of Web. config:

<Configuration>

<Rewriter>

<Rewriter url = "/my-super-product.aspx" to = "/product. aspx? Productid = 123 ">

</Rewriter>

...

Maybe, many people think this is not a good choice. In actual projects, it is impossible to have only one URL address to be rewritten. There are also URLs with multiple parameters and different parameters, next, let's talk about how to rewrite digital and multi-Keyword URL addresses.

 

Reference: Movie Sinal search engine optimization with ASP. NET: A developer's Guide To Seo

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.