The aspx file format uses URLRewriter for static conversion to html

Source: Internet
Author: User

Use the webpage program developed by asp.net and URLRewriter. dll for static.
A. Download urlrewriter.rar, decompress it, and put it in the/bin/directory.
B. Add urlrewriter.rar to the project reference.
C. Configure the IIS Site and point the extension html to the processing program aspnet_isapi.dll.
IIS Site-> properties-> Home Directory-> Configuration-> Add
The executable file is the same as the aspx file, which is c: \ windows \ microsoft.net \ framework \ v2.0.50727 \ aspnet_isapi.dll.
Do not check whether the file exists.
D. Add the configuration content in web. config, which is included in the compressed package. Copy codeThe Code is as follows: <configSections>
<Section name = "RewriterConfig"
Type = "URLRewriter. Config. RewriterConfigSerializerSectionHandler, URLRewriter"/>
</ConfigSections>
<! -- Actual redirection -->
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor> ~ /(\ D * cmd.html </LookFor>
<SendTo> ~ /User/default. aspx? Link = $1 </SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
<System. web>
<! --
You need to add html references to IIS and change them to aspx references.
-->
<HttpHandlers>
<Add verb = "*" path = "*. aspx"
Type = "URLRewriter. RewriterFactoryHandler, URLRewriter"/>
<Add verb = "*" path = "*. html"
Type = "URLRewriter. RewriterFactoryHandler, URLRewriter"/>
</HttpHandlers>

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

Static configuration of Apache Web Server Based on Apache HTTP Server (conf/httpd. conf)
A. Find LoadModule rewrite_module modules/mod_rewrite.so In the httpd. conf file.
This line is usually commented out and "#" is removed. If not, add the row.
B. Add the following code:Copy codeThe Code is as follows: <IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/(%0-9%%%%%.html $/user. php? User = $1
</IfModule>

C. If the website is defined by a VM, add it to the VM configuration file. htccess. Otherwise
Unavailable.
D. Restart Apache and re-load 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.