Seo practice: URL rewriting achieves static dynamic pages

Source: Internet
Author: User
Tags id3

Http://www.shareb2c.com/b2c-artical-27

 

I have long wanted to make our website static, but it takes a long time to complete the modification due to the huge workload of the entire website. Taking advantage of our low season, we finally finished the process.

The significance of Static Analysis for Seo is that the search engine has a catch on the question mark and "&" in the Link. Therefore, it is not conducive to the search engine's indexing of These webpages, and does not include the number of inner links.
Quantity. It is said that Google is improving its support for dynamic links, and I have never verified it. However, considering that there is not only one Google search engine, static work is still necessary.

Static, of course, has the advantages of more user-friendly user interfaces, which will not be detailed here.

There are many technologies to achieve static, such as the template method, but the maintenance work in the future will be very troublesome.

Finally, I chose the convenient pseudo-static technology, namely URL rewrite (URL rewriting ). After all, my goal is Seo. The so-called pseudo-static, that is, visitors and search engines cannot see the question mark and number, but in fact the page is still dynamic.

After comparison, we selected urlrewriting. Net (my website is based on. NET www.shirtonline.cn ). : Http://www.urlrewriting.net/155/de/downloads.html

It is easy to use. You only need to put the DLL file into the bin directory and configure it in Web. config. The main sections are as follows:

Add in the <configuration> node

<! -- For URL rewritingnet -->

<Configsections>

<Section name = "urlrewritingnet"
Requirepermission = "false"
Type = "urlrewritingnet. configuration. urlrewritesection,
Urlrewritingnet. urlrewriter "/>

</Configsections>

<! -- End for URL rewritingnet -->

Add in the <system. Web> node

<! -- For URL rewritingnet -->

<Httpmodules>

<Add name = "urlrewritemodule" type = "urlrewritingnet. Web. urlrewritemodule, urlrewritingnet. urlrewriter"/>

</Httpmodules>

<! -- End for URL rewritingnet -->

Or add it to the <configuration> node (after configsections)

<! -- For URL rewritingnet -->

<Urlrewritingnet rewriteonlyvirtualurls = "true" contextitemsprefix = "querystring" defaultpage = "index. aspx" defaultprovider = "RegEx" xmlns = "http://www.urlrewriting.net/schemas/config/2006/07">

<Rewrites>

<Add name = "rewriterule1"
Virtualurl = "^ ~ /(/D +). aspx"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /Default. aspx? Id = $1"
Ignorecase = "true"/>

<Add name = "rewriterule2"
Virtualurl = "^ ~ /Website/(. *)/default. aspx"

Rewriteurlparameter = "excludefromclientquerystring"

Destinationurl = "~ /Website/default. aspx? Id = $1"

Ignorecase = "true"/>

</Rewrites>

</Urlrewritingnet>

<! -- End for URL rewritingnet -->

Each <add> above is a rewrite rule. You can add rules as required.

You can implement four types of rewriting.

1. The extension remains unchanged, as shown in figure

<Add name = "rewriterule1"
Virtualurl = "^ ~ /(/D +). aspx"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /Default. aspx? Id = $1"
Ignorecase = "true"/>

The result of rewriting is to put the class such as default. aspx? The link id = 123456 is converted to 123456. aspx.

<Add name = "rewriterule2"
Virtualurl = "^ ~ /Website/(. *)/default. aspx"

Rewriteurlparameter = "excludefromclientquerystring"

Destinationurl = "~ /Website/default. aspx? Id = $1"

Ignorecase = "true"/>

The result of rewriting is to put the class such as website/default. aspx? Link id = 123456 is converted to website/123456/default. aspx

This type of rewrite does not have to be set on IIS. It is set by default. Some virtual hosts may need to be modified by the service provider. You need to make the following settings:

Website management-> properties-> directory-> Configuration (G
)...-> Ing-> application extension-> extension. aspx-> edit-> "Confirm file existence" check box not selected

2. Rewrite aspx to HTML

<Add name = "rewriterule3"

Virtualurl = "^ ~ /(/Dashboard .html"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /Default. aspx? Id = $1"
Ignorecase = "true"/>

The result of rewriting is to put the class such as default. aspx? Link id = 123456 to 123456.html

The configuration in IIS is as follows:

Website-> properties-> directory-> Configuration (G
)...-> Ing-> application extension-> Add
Executable File: C:/Windows/microsoft.net/framework/v2.0.50727/aspnet_isapi.dll
Extension:. html
Action: limit to get, Head, post, and debug
Script Engine: Selected
Check whether the file exists: No

3. Rewrite any extension

<Add name = "rewriterule4"
Virtualurl = "^ ~ /(/D +). myname"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /Default. aspx? Id = $1"
Ignorecase = "true"/>

The result of rewriting is to put the class such as default. aspx? The link id = 123456 is converted to 123456. myname

IIS configuration is the same as HTML.

4. Rewrite to a path

<Add name = "rewriterule5"
Virtualurl = "^ ~ /(. + )"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /Default. aspx? Id = $1"
Ignorecase = "true"/>

The result of rewriting is to put the class such as default. aspx? Link id = 123456 to/123456

IIS configuration: website> Properties> directory> Configuration (G
)...-> Ing-> wildcard application ing-> insert
Executable File: C:/Windows/microsoft.net/framework/v2.0.50727/aspnet_isapi.dll
Check whether the file exists: No

Note: In iis7
Below, override to path, that is, override settings without extension is as follows (refer to http://www.improve.dk/blog/2006/12/11/making-url-rewriting-on-iis7-work-like-iis6
)

1. Go to "handler ing" on the iis7 management interface, find staticfile, enter edit, and change * *. * Replace "file or file plus" in "request restriction" with "file"

2. Click "add script ing" on the right side, and set the Request Path to *. Enter the executable file.
% WINDIR %/Microsoft. NET/framework/v2.0.50727/aspnet_isapi.dll
In "request restrictions", remove the "only when the request is mapped to..." option, and retrieve the name by yourself, such as "all ". Are you sure you want to save

3. Click "view sorted list" on the right to move the "all" you just added to the staticfile

The preceding three steps can be used.

In iis7, you must use the "classic application pool" to rewrite the URL.

 

If you have multiple parameters, see the following example,

<Add name = "rewriterule6"
Virtualurl = "^ ~ /Website/(. *)/default. aspx"
Rewriteurlparameter = "excludefromclientquerystring"
Destinationurl = "~ /Website/default. aspx? Id1 = $1 & amp; Id2 = $2 & amp; ID3 = $3"
Ignorecase = "true"/>

The preceding (. *)/(. *)/(. *) are sequential id1, Id2, and ID3.

The result of rewriting is to put the class such as website/default. aspx? Id1 = 12 & Id2 = 34 & ID3 = 56 links are converted to website/12/34/56/default. aspx

The above rules involve regular expressions.
Statement. Please refer to the regular expression search tutorial.

My website has rewritten key pages, but not user account pages, saving part of the workload.

 

In addition, rewriting will occupy server resources, especially in the form of pure paths (Appeal 4th class rewriting). Every image will be redirected and there is a solution on the Internet. I have not tried it. You can search for it.

 

If it is only for Seo purposes, you do not have to rewrite aspx into HTML, because the major search engines currently have the same support for aspx and HTML. Remove the question mark, &, and so on. However, it is best to rewrite the path-only method, because for search engines, the path weight is higher than the file weight.

 

 

Welcome to the discussion.

Related Article

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.