activate mod_rewrite How To Set Up mod_rewrite for Apache on Ubuntu 14.04 Apache Rewrite url重定向功能的简单配置
https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite-for-apache-on-ubuntu-14-04
ubuntu@ubuntu:~$ su
Password:
root@ubuntu:/home/ubuntu# a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
service apache2 restart
root@ubuntu:/home/ubuntu# service apache2 restart
https://httpd.apache.org/docs/2.4/en/rewrite/
将任意的url 映射为服务器内部的url结构
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.
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.
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.
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 reference documentation
- Introduction to regular expressions and mod_rewrite
- Using mod_rewrite for redirection and remapping of URLs
- Using mod_rewrite to control access
- Dynamic virtual hosts with mod_rewrite
- Dynamic proxying with mod_rewrite
- Using RewriteMap
- Advanced techniques
- When NOT to use mod_rewrite
- RewriteRule Flags
- Technical details
Character | Meaning | Example |
---|---|---|
. |
Matches any single character | c.t will match cat , cot , cut , etc. |
+ |
Repeats the previous match one or more times | a+ matches a , aa , aaa , etc |
* |
Repeats the previous match zero or more times. | a* matches all the same things a+ matches, but will also match an empty string. |
? |
Makes the match optional. | colou?r will match color and colour . |
^ |
Called an anchor, matches the beginning of the string | ^a matches a string that begins with a |
$ |
The other anchor, this matches the end of the string. | a$ matches a string that ends with a . |
( ) |
Groups several characters into a single unit, and captures a match for use in a backreference. | (ab)+ matches ababab - that is, the + applies to the group. For more on backreferences see below. |
[ ] |
A character class - matches one of the characters | c[uoa]t matches cut , cot or cat . |
[^ ] |
Negative character class - matches any character not specified | c[^/]t matches cat or c=t but not c/t |
最新文章
- unity 3d 解析 json
- fasicon.js (无二维码版,如需要js创建二维码版本可联系我:770959294@qq.com)
- html form 提交表单的一些问题
- Java获取当前时间年月日、时间格式化打印、字符串转日期
- VPS CentOS-6 下 LNMP HTTP服务器的搭建
- java之多态(Polymorphic)、动态绑定(Dynamic Binding)、迟绑定(Late Binding)
- bianwu | 数据行 | 填写意见
- Spring MVC 之类型转换(五)
- 读取excel文件内容代码
- hdu2023 求平均成绩 ~~很闲~~~
- Asp.net中基于Forms验证的角色验证授权
- 用java面向对象的思想实现的汉诺塔问题
- MySQL percona-toolkit工具包的使用教程
- Git----GitHub Desktop的入门及使用
- Fiddler-弱网测试设置
- 【JS基础】类型转换——不同数据类型比较
- beego 实现API自动化文档
- VMware Workstation Pro 14 虚拟机安装教程
- 《汇编语言 基于x86处理器》第九章字符串与数组部分的代码
- visual studio使用GitHub