Continue urlrewrite. Today we bring some more things.

Source: Internet
Author: User
First of all, turn an article, source: http://www.zuoyefeng.com/show.aspx? Id = 79 & cid = 70

URL rewrite. My translation is URL rewriting or URL redefinition. In ASP + IIS web development mode, can be implemented such as the http://xxxxxx.cn/news.asp? Id = 220 is in the form of a http://xxxxxx.cn/220.html. For example, the actual website of a news article is http://xxxxxx.cn/news.asp? Id = 220. After URL rewriting, we can directly enter the URL of the http://xxxxxx.cn/220.html to access the news.

For IIS servers, to achieve this feature, you need to download the lite version (free) free version of the software from the http://www.helicontech.com/download/ website, the software installed on the server, in its installation directory, find the configuration file httpd. INI, open it in notepad, and enter the corresponding rules. Then, add this component to ISAPI on the corresponding site. OK. The configuration is complete and the function takes effect.

2. For details about how to write url_rewrite rules, refer:

When I need? When id = 234 is mapped to news/234.html, you only need to set:

Rewriterule/news/(\ D +) \. html/news \. asp \? Id = $1 [N, I]

In this way, requests such as/news/234.html are mapped to/news. asp? Id = 234
When there is a request for/news/234.html: the Web server will forward the actual request to/news. asp? Id = 234

For a simple application:

Rewriterule/news/(\ D +) \. html/news \. php \? Id = $1 [N, I]

So we map the http://www.xxxxxx.com/news/234.html to the http://www.xxxxxx.com/news/news.php? Id = 234

A more general expression that can map parameters of all dynamic pages is:
Put http://www.xxxxxx.cn/foo.php? A = A & B = B & C = C
Represented as http://www.xxxxxx.cn/foo.php/a/A/ B/B /c/C

Rewriterule (.*? \. Php )(\? [^/] *)? /([^/] *)/([^/] *) (. + ?)? $1 (? 2 $2 &:\?) $3 = $4? 5 $5: [N, I]

3. Benefits of using URL rewriting:

First, it helps increase website security because it hides server technologies such as asp php jsp and presents them to customers in the most primitive HTML file format.

Second, when the platform is migrated, there will be no websites on each page. For example, add news. asp? Id = 123 transfer news. php? Id = 123, which transfers the ASP platform to PhP. If this URL is used for rewriting, the URL of this page is news/123.html.

In other aspects, it facilitates URL reference and facilitates enumeration of search engines.

Here is the Chinese version of isapi_rewrite third-party components:
Http://www.isapirewrite.cn/docs/
Other related URL rewriting extension Products
Abc_rewrite
Http://www.jrsw.com/iis/index.html

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.