IIS configuration page rewrite (with plugin url-rewrite2 remove page suffix name)

Source: Internet
Author: User

Had always wanted to know how to remove the URL suffix in the address bar of the browser, today just time to toss a bit.

The following is a reference to a Bo friend article (from the end of the article), based on the Windows platform (windows7) detailed description.

1. URL Rewrite component Url-rewrite2

Microsoft Official: Http://www.iis.net/downloads/microsoft/url-rewrite

can also be directly downloaded: url-rewrite.zip

2. Pausing IIS, installing Components

Pause IIS before you install the components.

The component installation is currently (2017/10/30) integrated with Microsoft Web Platform Installer (hereinafter referred to as Platform Installer). If you have installed platform Installer, double-click the run Url-rewirte.exe may not appear after the installation interface (prompt) situation, the Start menu found Platfom Installer, and open, you can enter the installation interface.

3. Restart IIS, install the components

Find the Web site you want to set up in IIS, click to select the URL rewrite feature in the tools on the right, and restart the system if you still don't see the feature after restarting IIS.

3.. htaccess

Create a new. htaccess file under the Web site root, which is a configuration file related to the Url-rewrite2 component that defines the rewrite rules. Write the following text message in it:

Rewriteengine on #将RewriteEngine引擎设置为on, is to let the URL rewrite take effect;
rewritebase/ #用于设定重写的基准URL, note there are no spaces between "rewritebase" and "/"
Rewriterule ^index\.php$
Rewriterule ^ (. *)/([\w\-]+) $ $1/$2.php

The detailed rules and explanations refer to the following articles:

. htaccess tips: URL rewriting (Rewrite) and redirection

htaccess Appendix: Regular expressions, redirect codes

4. Import Rules

Select the URL rewrite feature, and on the right, locate the import rule. "Feature, and click.

Select your . htaccess file, then click on the "Import" button and finally click on the "Apply" button on the right to successfully configure pseudo-static.

5. Conclusion

The page rewrite rule under IIS has been completed. It is necessary to note that page rewrite rules can be understood as server-assisted completion/decoration URLs. For example, the rules written in this article

Rewriterule ^ (. *)/([\w\-]+) $ $1/$2.php

The suffix name in the address bar will be auto-complete. php.

If the user enters Localhost/test/pagename in the address bar, the actual path is localhost/test/pagename.php.

Reference article: http://www.cnblogs.com/huangcong/p/5205583.html
Original bill
Source: http://www.cnblogs.com/huangcong/
This article is copyright to the author and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.

IIS configuration page rewrite (with plugin url-rewrite2 remove page suffix name)

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.