看到下面这段代码:

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 ollewill 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 RewriteRulesNOTE: 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 什么意思的更多相关文章

  1. Apache RewriteRule

    1.Rewirte主要的功能就是实现URL的跳转,它的正则表达式是基于Perl语言.可基 于服务器级的(httpd.conf)和目录级的 (.htaccess)两种方式.如果要想用到rewrite模块 ...

  2. 伪静态与重定向--RewriteRule

    环境:windows 10,phpstudy,sublime text.服务器使用Apache,网站根目录为E:\phpstudy\www\,所以.htaccess放在www目录下. RewriteR ...

  3. No input file specified的解决方法apache伪静态

    http://jingyan.baidu.com/article/dca1fa6f8d623ff1a44052e8.html (一)IIS Noinput file specified 方法一:改PH ...

  4. Nginx的Rewrite规则与实例

    通过Rewrite规则可以实现规范的URL.根据变量来做URL转向及选择配置,用好Rewrite有时起到事半功倍的效果. 语法 Nginx的Rewrite相比Apache的要好理解很多,主要使用指令有 ...

  5. PHP no input file specified 三种解决方法

    一.IIS Noinput file specified   (IIS上报的错误) 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二: 请修改php.i ...

  6. No input file specified.

    no input file specified 解决方法 2018年02月23日 14:25:07 tiramisuer8023 阅读数:36607   版权声明:本文为博主原创文章,未经博主允许不得 ...

  7. 地址重写 No input file specified的解决方法

    转载自:http://blog.csdn.net/williamsblog/article/details/37532737 (一)IIS Noinput file specified 方法一:改PH ...

  8. No input file specified的解决方法

    (一)IIS Noinput file specified 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二:请修改php.ini找到; cgi.for ...

  9. no input file specified 三种解决方法

    一.IIS Noinput file specified 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二: 请修改php.ini 找到 ; cgi.f ...

随机推荐

  1. zoj3802:easy 2048 again(状压dp)

    zoj月赛的题目,非常不错的一个状压dp.. 题目大意是一个一维的2048游戏 只要有相邻的相同就会合并,合并之后会有奖励分数,总共n个,每个都可以取或者不取 问最终得到的最大值 数据范围n<= ...

  2. chrome加载本地js

    通过chrome的扩展功能,可以执行一些本地脚本. 1.如何添加扩展程序 具体做法是:chrome -> 设置 -> 扩展程序 -> 加载正在开发的扩展程序 图(1.1) 图(1.2 ...

  3. 第25讲 UI组件之 AlertDialog 的各种实现

    第25讲 UI组件之AlertDialog 的各种实现 对话框(Dialog)是程序运行中的弹出窗口,例如当用户要删除一个联系方式时,会弹出一个对话框. Android提供了多种对话框:警告对话框(A ...

  4. 无Root抓包:Packet Capture 1.2.3

    无Root抓包:Packet Capture 1.2.3 http://www.coolapk.com/apk/app.greyshirts.sslcapture

  5. android layout属性介绍

    android:id 为控件指定对应的ID android:text 指定控件其中显示的文字,须要注意的是,这里尽量使用strings.xml文件其中的字符串 android:gravity 指定Vi ...

  6. oracle 格式化数字 to_char

    转:http://blog.csdn.net/chinarenzhou/article/details/5748965 Postgres 格式化函数提供一套有效的工具用于把各种数据类型(日期/时间,i ...

  7. [RxJS] Starting a Stream with SwitchMap & switchMapTo

    From an event map to another event we can use switchMap(), switchMap() accept an function which retu ...

  8. gstreamer让playbin能够播放rtp over udp流数据

    最近一段时间在研究传屏低延迟传输相关的一些东西.本来想使用gstreamer来验证下rtp over udp传送h264 nal数据相关 的,结果发现竟然不能用playbin来播放rtp的数据!诚然, ...

  9. c# 取得扩展名

    string KZM=files[0].FileName.Substring(files[0].FileName.LastIndexOf(".") + 1);

  10. 《第一行代码》学习笔记15-UI(4)

    1.ListView允许用户通过手指上下滑动的方式将屏幕外的数据滚动到屏幕内,同时屏幕上原有的数据则会滚动出屏幕. 2.数组中的数据无法直接传递给ListView,得借助适配器来完成.此处使用Arra ...