ASP Tutorial: Urlrewrite using reference documentation

Source: Internet
Author: User
Tags documentation expression iis ini reference regular expression root directory
Reference | tutorials

ASP Tutorial: Urlrewrite using reference documentation

What is Urlrewrite?
Urlrewrite is a technique for converting static pages into dynamic pages. For example, your site page is http://www.yourdomain.com/news/docread.aspx?id=123 using urlrewrite conversion to http://www.yourdomain.com/news/ 123.html to access.

The use of Urlrewrite: to meet the requirements of search engines, Google can crawl dynamic pages, but Google's dynamic page rating is generally lower than the static page.

Urlrewrite has different settings for the IIS server and the Apache server. The two configuration methods are different. Please pay attention to the vast number of users.

Apache Server settings: You need to create a. htaccess file in the site root. Write rules.

IIS Server settings: You need to create a Httpd.ini configuration file in the site root and write rules.

Because the Httpd.ini and Apache. htaccess files under IIS are two completely different configurations. Two cannot be used interchangeably. Writing Urlrewrite requires a professional technician.

How do I set the Urlrewrite for the IIS server's Web site?

Note Using Urlrewrite cannot open a Web site custom 404 error, otherwise urlrewrite will not work properly

Isapi_rewrite uses regular expressions to represent the substitution rules.
You need to create a Httpd.ini configuration file in your site root directory with Urlrewrite configuration information.

Here's what httpd.ini.

#-----------------Httpd.ini file content, you can copy it and upload it to your site's root directory-----------
[Isapi_rewrite]
# 3600 = 1 hour set cache time 1 hours
Cacheclockrate 3600
# Sets the number of regular expression substitution variables.
Repeatlimit 32

# Protect Httpd.ini and httpd.parse.errors files from accessing through HTTP
# The following urlrewrite rules are downloaded to avoid configuration files such as Httpd.ini httpd.errors the site.
Rewriterule ^/httpd (?: \. ini|\.parse\.errors). * [F,i,o]

# formal Urlrewrite rules, meaning that http://server/123.html will be accessing dynamic pages http://server/urlrwtest.asp?id=123
# You need to make changes to your site
Rewriterule/([0-9]*). html/urlrwtest.asp\?id=$1
#-----------------The end of the Httpd.ini file-----------


Urlrwtest.asp File Example:
<%response.write "Urlrewrite test: The ID number you accessed is:" & Request ("id")%>

The file is saved before it can be entered into effect.
Urlrewrite supports various scripts such as asp,asp.net,php.

Urlrewrite Common Errors
1.404 error (Page not found): No web site root created Httpd.ini file or regular expression error, will cause the page can not find errors
2.500 error (scripting error): Target Dynamic page program error
3.404 user-defined error: If the site administrator has turned on 404 Web site customization errors, Urlrewrite will not work correctly.



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.