Apache RewriteRule QSA 什么意思
看到下面这段代码:
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
The RewriteRule basically means that if the request is done that matches ^(.+)$
(matches any URL ), it will be rewritten as index.php?url=$1
which means a request for olle
will be rewritten as index.php?url=olle
.
QSA
means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1
will be rewritten as index.php?url=olle&p=1
.
L
means if the rule matches, don't process any more RewriteRules below this one.
参考:http://stackoverflow.com/questions/12551382/what-does-1-qsa-l-mean-in-my-htaccess-file
QSA = Query String Append.
This rule appends the GET query string which results from the ReWrite rule to the initial GET query string sent by the browser. For example, take the following RewriteRule:
- RewriteRule ^/product/([0-9]*)/? /product.php?product_id=$1 [QSA]
This simply makes the product_id number look like a directory to the user. Now say that I have two different views of the page, view=short and view=long. For whatever reason, I don't want to make these views look like directories by using a RewriteRule. So I want to be able to do things like:
http://mysite.com/product/1351283/?view=short
Let's see how QSA works. With QSA, my final rewritten URL is
http://example.com/product.php?product_id=1351283&view=short
QSA has caused the RewriteEngine to append the existing query string (view=short) to the new query string (product_id=1351283). Without QSA, the existing query string is simply replaced by the new query string:
http://example.com/product.php?product_id=1351283
If you do much scripting with reliance on GET variables, it is virtually imperative that you enable the QSA flag on all of your RewriteRules. NOTE: I'm not sure how this works with PHP's session identifiers, which can be passed in the URL as a GET variable instead of a session cookie. This would probably be useful to know.
参考:http://wiki.apache.org/httpd/RewriteFlags/QSA
Apache RewriteRule QSA 什么意思的更多相关文章
- Apache RewriteRule
1.Rewirte主要的功能就是实现URL的跳转,它的正则表达式是基于Perl语言.可基 于服务器级的(httpd.conf)和目录级的 (.htaccess)两种方式.如果要想用到rewrite模块 ...
- 伪静态与重定向--RewriteRule
环境:windows 10,phpstudy,sublime text.服务器使用Apache,网站根目录为E:\phpstudy\www\,所以.htaccess放在www目录下. RewriteR ...
- No input file specified的解决方法apache伪静态
http://jingyan.baidu.com/article/dca1fa6f8d623ff1a44052e8.html (一)IIS Noinput file specified 方法一:改PH ...
- Nginx的Rewrite规则与实例
通过Rewrite规则可以实现规范的URL.根据变量来做URL转向及选择配置,用好Rewrite有时起到事半功倍的效果. 语法 Nginx的Rewrite相比Apache的要好理解很多,主要使用指令有 ...
- PHP no input file specified 三种解决方法
一.IIS Noinput file specified (IIS上报的错误) 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二: 请修改php.i ...
- No input file specified.
no input file specified 解决方法 2018年02月23日 14:25:07 tiramisuer8023 阅读数:36607 版权声明:本文为博主原创文章,未经博主允许不得 ...
- 地址重写 No input file specified的解决方法
转载自:http://blog.csdn.net/williamsblog/article/details/37532737 (一)IIS Noinput file specified 方法一:改PH ...
- No input file specified的解决方法
(一)IIS Noinput file specified 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二:请修改php.ini找到; cgi.for ...
- no input file specified 三种解决方法
一.IIS Noinput file specified 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二: 请修改php.ini 找到 ; cgi.f ...
随机推荐
- android开发论坛
http://www.hiapk.com/ http://bbs.hiapk.com/ http://bbs.gfan.com/ http://bbs.anzhi.com/ http://www.ap ...
- 浅谈单片机、ARM和DSP的异同
犹记得当年读书的时候,老师说单片机.ARM.DSP有互通之处,都是CPU,但听老师讲都听不懂. 我该如何理解他们,并找出他们的异同呢?我们来看看行内人的看法: ICer,从事ARM CPU的SOC设计 ...
- hdu5023--A Corrupt Mayor's Performance Art
来源:2014 ACM/ICPC Asia Regional Guangzhou Online 题意:长度为n的一个线段,1-30为颜色代号.初始状态每个单位长度颜色都为2,然后有q次操作,P操作把区 ...
- syslog_test.c 简单的syslog函数
#cat syslog_test.c #include<stdio.h> #include<stdlib.h> #include<syslog.h> int mai ...
- 如何在 Android 手机上实现抓包?
如何在 Android 手机上实现抓包? http://www.zhihu.com/question/20467503 我想知道某个应用究竟在数据提交到哪里,提交了什么.网上的教程太复杂,不想麻烦.有 ...
- 用于防SQL注入的几个函数
不要相信用户的在登陆中输入的内容,需要对用户的输入进行处理 SQL注入: ' or 1=1 # 防止SQL注入的几个函数: addslashes($string):用反斜线引用字符串中的特殊字符' & ...
- mybatis 调用mysql存储过程 带输出输入参数
http://lohasle.iteye.com/blog/1669879 存储过程都是一样的,只是根据自己的喜好,可以用MAP或者JAVABEAN传递参数. -- ----------------- ...
- Pojo和JavaBean的区别(转载)
OJO(Plain Old Java Object)这个名字用来强调它是一个普通java对象,而不是一个特殊的对象. 2005年11月时,“POJO”主要用来指代那些没用遵从特定的Java对象模型,约 ...
- openwrt上网配置的一些理解
其实已经有很多帖子讲过openwrt路由器上网配置了,我这里主要是讲我自己的一块硬件路由使用openwrt后的一些上网配置.之所以要研究我自己的配置,是因为硬件,硬件不一样,配置也就不一样,但是总的原 ...
- Ubuntu 12.04设置打开远程桌面登录1
teamviewer_linux.deb sudo dpkg --install teamviewer_linux.deb