Apache 学习笔记 - Apache mod_rewrite

http://httpd.apache.org/docs/2.4/en/rewrite/

mod_rewrite provides a way to modify incoming URL requests, dynamically, based on regular expression rules. This allows you to map arbitrary URLs onto your internal URL structure in any way you like.

mod_rewrite提供了一种基于正则表达式规则动态修改传入URL请求的方法。 这允许您以任何喜欢的方式将任意URL映射到您的内部URL结构。

It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule to provide a really flexible and powerful URL manipulation mechanism. The URL manipulations can depend on various tests: server variables, environment variables, HTTP headers, time stamps, external database lookups, and various other external programs or handlers, can be used to achieve granular URL matching.

它支持无限数量的规则,并为每个规则提供无限数量的附加规则条件,以提供真正灵活和强大的URL操作机制。URL操作可以依赖于各种测试:服务器变量,环境变量,HTTP头,时间戳,外部数据库查找以及各种其他外部程序或处理程序,可用于实现精细的URL匹配。

Rewrite rules can operate on the full URLs, including the path-info and query string portions, and may be used in per-server context (httpd.conf), per-virtualhost context (<VirtualHost> blocks), or per-directory context (.htaccess files and <Directory> blocks). The rewritten result can lead to further rules, internal sub-processing, external request redirection, or proxy passthrough, depending on what flags you attach to the rules.

重写规则可以对完整的URL进行操作,包括路径信息和查询字符串部分,并可用于每个服务器上下文(httpd.conf),每个虚拟主机上下文(<VirtualHost>块)或每个目录上下文(.htaccess文件和<Directory>块)。重写的结果可能导致进一步的规则,内部子处理,外部请求重定向或代理直通,具体取决于您附加到规则的标志。

Since mod_rewrite is so powerful, it can indeed be rather complex. This document supplements the reference documentation, and attempts to allay some of that complexity, and provide highly annotated examples of common scenarios that you may handle with mod_rewrite. But we also attempt to show you when you should not use mod_rewrite, and use other standard Apache features instead, thus avoiding this unnecessary complexity.

由于mod_rewrite非常强大,它确实可能相当复杂。本文档对参考文档进行了补充,并试图消除其中的一些复杂性,并提供可以使用mod_rewrite处理的常见场景的高度注释的示例。但是我们也试图告诉你什么时候不应该使用mod_rewrite,而是使用其他标准的Apache特性来避免这种不必要的复杂性。

  1. mod_rewrite参考文档 (mod_rewrite reference documentation)
  2. 正则表达式和mod_rewrite简介(Introduction to regular expressions and mod_rewrite)
  3. 使用mod_rewrite进行URL重定向和重新映射(Using mod_rewrite for redirection and remapping of URLs)
  4. 使用mod_rewrite来控制访问(Using mod_rewrite to control access)
  5. 动态虚拟主机与mod_rewrite(Dynamic virtual hosts with mod_rewrite)
  6. 使用mod_rewrite进行动态代理(Dynamic proxying with mod_rewrite)
  7. 使用RewriteMap(Using RewriteMap)
  8. 先进的技术(Advanced techniques)
  9. 何时不使用mod_rewrite(When NOT to use mod_rewrite)
  10. 重写规则标志(RewriteRule Flags)
  11. 技术细节(Technical details)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
支持GPL协议: one line to give the program\'s name and an idea of what it does. Copyright (C) Ports Project 2007/01/30 horse_b This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.      horse_b 研究了6年代码跨平台移植项目,可以做大部分项目的移植,在这里的项目大部分是GPL工程 所以大家得到我的PORTS工程以后,也请尊重GPL协议   文件列表: libpcap-cygwin-port.tar.gz libnet-cygwin-port.tar.gz libtiff-cygwin-port.tar.gz libtiff-mingw-port.tar.gz libtiff-vc-vs.net-port.rar 说明: 所有这些PORTS项目都是horse_b的个人制作,2001年我为NIDS系统软件SNORT项目做了一个WIN32-Port的项目, 应该比SNORT作者出win32 port要早半年,但是我没有公开过这个WIN32 PORT,这个项目的WIN32 的二进制程序 在黑客网站黑白中可以找到 http://www.yiii.net/app/club/view.jsp?Information_Id=I00014317 抓包驱动snort182drv.zip http://www.yiii.net/app/club/view.jsp?Information_Id=I00014560 ids.zip 请大家尊重我的劳动,不允许任意改动我做的PORTS项目,用要做PORTS项目的,请发邮件和我联系 如果有人和我讨论移植和开发编译器,可以来信和我讨论: 我的专门接受此类问题的EMAIL: winddk64@gmail.com 或者 winddk64@163.com       技术下载区 Libpcap cygwin port下载:    libpcap-cygwin-port.tar.gz libnet cygwin port下载: libnet-cygwin-port.tar.gz   libtiff cygwin port下载: libtiff-cygwin-port.tar.gz libtiff mingw port下载: libnet-mingw-port.tar.gz (这个工程我觉得有VC和VS。NET的PORT了,我就没做这个PORT,有人要这个PORT,可以和我联系,半天就能搞定了) libtiff vc++&

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值