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 每创建一个帐户,都需要手 ...
随机推荐
- cocos2d-x onMouseMove中CCTouch *pTouch参数的细节
/**************************************************************************** Copyright (c) 2010 coc ...
- Python处理文件以及文件夹常用方法
1.创建文件并且写入 2.多行读取文件的方式 readlines() 3.一次读取全部内容 4.文件的删除 5.shutil 模块实现文件的复制 6.文件的重命名 7.获取文件的后缀名 8.pytho ...
- 卖座网一处SQL注射(Http Referer sqlinjection)
漏洞作者: 猪猪侠 漏洞详情 披露状态: 2015-01-13: 细节已通知厂商并且等待厂商处理中2015-01-14: 厂商已经确认,细节仅向厂商公开2015-01-24: 细节向核心白帽子及相关领 ...
- Java反射机制的基本概念与使用
本篇文章分为以下几个部分: 1.认识反射 2.反射的源头(Class类) 3.利用反射操作构造方法 4.利用反射调用类中的方法 5.反射中的invoke方法 6.利用反射调用类中的属性 反射在我们普通 ...
- codeforces 429 On the Bench dp+排列组合 限制相邻元素,求合法序列数。
限制相邻元素,求合法序列数. /** 题目:On the Bench 链接:http://codeforces.com/problemset/problem/840/C 题意:求相邻的元素相乘不为平方 ...
- 小贝_redis 高级应用-事务
redis高级应用-事务 一.redis的事务 二.redis实现事务 三.redis事务问题 一.redis的事务 事务提供了一种"将多个命令打包,然后一次性.按顺序地运行"的机 ...
- 从文件/文件流的头字节中得到mime信息
在写网络爬虫的时候,需要根据链接来获取文件类型,将内容正确存储.之前我都是根据链接的后缀来判断的,比如: http://img12.360buyimg.com/da/20120330/88_31_Zy ...
- PostgreSQL入门指南
默认端口:5432 创建用户与数据库 PostgreSQL初次安装后,默认会生成一个名为postgres的数据库和一个名为postgres的数据库用户.这里需要注意的是,同时还生成了一个名为postg ...
- js实现div的置底
//-------------置底的div---------------------- <div class="mui-content lv-mrcd" id=" ...
- js实现EasyUI-datagrid前台分页
//实现假分页 function myLoader(param, success, error) { var that = $(this); var opts = that.datagrid(&quo ...