Apache Rewrite_mod Classic Questions and Answers

Source: Internet
Author: User

1.RewriteRule ^ (com\/.*) $ index.php?do=$1

Q: What is the match for the rule match expression "^ (. *) $" above?

A: Match content is URI
Site Directory:/d/www
url:http://127.0.0.1/admin/index.php
Corresponding local file:/d/www/admin/index.php, If it is a Windows file system, because it is not case-sensitive, if the directory under the site is the admin, then the file address here will become:/d/www/admin/ index.php, the following URI will change as Well.
Uri:admin/index.php, where the URI is removed from the file system, the part of the site directory differs from "%{request_uri}". If the directory under the site is admin,uri=admin/index.php

%{request_uri}:/admin/index.php, the part where Rul removed the domain name.

%{request_filename}:urlcorresponding to local files, here are a few points to note:
1.windows file system, The conversion is automatically based on the local folder case
2.FILENAME will automatically remove the extra parts, such as /d/www/admin/setting/index.php, If admin is an empty folder, there is nothing in it, Here's %{request_filename} =/d/www/admin/setting, it is estimated that Apache filesystem is traversed from the top-level directory, and when a directory does not exist, it is interrupted from this nonexistent directory Address.


2. Infinite loop causes error

There are multiple rewriterule in the rewrite rule, and a match to the rewriterule tag adds [L], which means that after the parsing of the rule is stopped, the subsequent rule will still run,

A: In the rewrite process, any one of the rewriterule is executed, and the entire process is repeated with the new URI until the entire process has not been rewritten to end the rewrite Program.

Apache Rewrite_mod Classic Questions and Answers

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.