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 |
activate mod_rewrite How To Set Up mod_rewrite for Apache on Ubuntu 14.04 Apache Rewrite url重定向功能的简单配置的更多相关文章
- Ubuntu系统启用Apache Mod_rewrite模块
在终端中执行 sudo a2enmod rewrite 指令后,即启用了 Mod_rewrite 模块. 另外,也可以通过将 /etc/apache2/mods-available/rewrite.l ...
- Debian/Ubuntu下安装Apache的Mod_Rewrite模块的步骤
启用 Mod_rewrite 模块:sudo a2enmod rewrite 另外,也可以通过将 /etc/apache2/mods-available/rewrite.load 连接到 /etc/a ...
- Debian/Ubuntu下安装Apache的Mod_Rewrite模块的步骤分享
启用 Mod_rewrite 模块:sudo a2enmod rewrite 另外,也可以通过将 /etc/apache2/mods-available/rewrite.load 连接到 /etc/a ...
- Drupal7配置简洁URL(Clear URL)
参考:Apache Rewrite url重定向功能的简单配置 这两天折腾死了 首先说一下我的环境: Aache2.4.25-x64-vc14-r1;php-7.0.19-Win32-VC14-x64 ...
- apache url路由配置重写
最近复习了一下Apache Rewrite url重定向功能,有个项目用到了.htaccess,简单的几行代码,是看不怎么明白,于是复习了一下. 1.Apache Rewrite的主要功能 就是实现U ...
- 让网站通过Https访问
Prerequisites Before you begin, you should have some configuration already taken care of. We will be ...
- Docker - 在Ubuntu 14.04 Server上的安装Docker
在 Ubuntu 14.04 Server 上安装过程是最简单的, 其满足了安装 Docker的所有要求,只需要执行如下安装脚本即可. 如果你有可能,请使用14.04版本的Ubuntu, 避免给自己挖 ...
- modsecurity配置指令学习
事务(transactions) Console(控制台) 1 Introduction Modsecurity是保护网络应用安全的工作.不,从零开始.我常称modsecurity为WAF(网络应用防 ...
- Ubuntu下Apache+SVN+submin实现WEB管理SVN
为什么需要submin管理SVN? 原来在Ubuntu下,都是直接通过命令行创建SVN仓库并分配权限,但是这有一些问题: 每创建一个SVN仓库,都需要修改httpd.conf 每创建一个帐户,都需要手 ...
随机推荐
- 绕过IE10直接安装VS2013
参考资料:http://blog.163.com/qimo601%40126/blog/static/1582209320143354446462/ 这SB设定我就懒得说了,安个IE10要安装N多WI ...
- std::string与output-operator"<<"的兼容问题
经查阅资料得知,“在某些编译器下std::string,需要使用c_str()才能作为output-operator "<<" 的参数” std::string tit ...
- ad7888 linux driver
/* ADCCONVERT.c : Generate ADC signals from SPI ports, as the A/D control signals. Author: Aaron Fu ...
- Android——gridLayout(网格布局)
<?xml version="1.0" encoding="utf-8"?> <GridLayout xmlns:android=" ...
- PHP——字符串
<?php //strlen("aaa");取字符串的长度 *** echo strlen("aaaaa"); echo "<br /&g ...
- 二分 + 模拟 - Carries
Carries Problem's Link Mean: 给你n个数,让你计算这n个数两两组合相加的和进位的次数. analyse: 脑洞题. 首先要知道:对于两个数的第k位相加会进位的条件是:a%( ...
- java--Struts中请求的过程
一个请求在Struts2框架中的处理步骤: a) 客户端初始化一个指向Servlet容器的请求: b) 根据Web.xml配置,请求首先经过ActionContextCleanUp过滤器,其为可选过滤 ...
- 【BZOJ】1088: [SCOI2005]扫雷Mine(递推)
http://www.lydsy.com/JudgeOnline/problem.php?id=1088 脑残去想递推去了... 对于每一个第二列的格子,考虑多种情况,然后转移.....QAQ 空间可 ...
- 【DeepLearning】一些资料
记录下,有空研究. http://nlp.stanford.edu/projects/DeepLearningInNaturalLanguageProcessing.shtml http://nlp. ...
- Target frameworks
https://docs.microsoft.com/en-us/dotnet/standard/frameworks When you target a framework in an app or ...