aspx file format using Urlrewriter to implement static becomes Html_ practical skill

Source: Internet
Author: User
Tags rar
Using the Web page program developed by ASP.net, use URLRewriter.dll to achieve static.
A. Download the Urlrewriter.rar and put it in the/bin/directory after decompression
B. Add Urlrewriter.rar to the project reference.
C. Configure the IIS site with the extension HTML pointing to the handler Aspnet_isapi.dll.
IIS site-> Properties-> home Directory-> configuration-> add
Executable files are the same as ASPX processing and are C:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
Be careful not to choose to check whether the file exists.
D. Add the configuration content in the web.config, in the compressed package.
Copy Code code as follows:

<configSections>
<section name= "Rewriterconfig"
Type= "URLRewriter.Config.RewriterConfigSerializerSectionHandler, Urlrewriter"/>
</configSections>
<!--actual redirect-->
<RewriterConfig>
<Rules>
<RewriterRule>
<lookfor>~/(\d*) .html</lookfor>
<SendTo>~/user/default.aspx?link=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<system.web>
<!--
You need to add an HTML reference to the IIS and change it to an ASPX reference
-->
<add verb= "*" Path= "*.aspx"
Type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>
<add verb= "*" Path= "*.html"
Type= "Urlrewriter.rewriterfactoryhandler, Urlrewriter"/>

E. Enter [Url]http://localhost/1.html[/url] in the address bar to point [Url]http://localhost/user/default.aspx?link=1[/url]

Static Apache WEB Server configuration based on Apache HTTP Server (conf/httpd.conf)
A. Find LoadModule rewrite_module in the httpd.conf file modules/mod_rewrite.so
Usually the line is commented and the "#" is removed. If not, increase the line.
B. Add code:
Copy Code code as follows:

<ifmodule mod_rewrite.c>
Rewriteengine on
Rewriterule ^/([0-9]+). html$/user.php?user=$1
</IfModule>

C. If a Web site is defined using a virtual host, be sure to add it to the virtual host configuration file. Htccess, or maybe
cannot be used.
D. Restart Apache and reload the configuration.
E. Enter [Url]http://localhost/1.html[/url] in the address bar and actually point to [Url]http://localhost/user.php?user=1[/url]

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.