看到下面这段代码:

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. js深入研究之自定义混合Mixin函数

    <script type="text/javascript"> /* 增加函数 */ function augment(receivingClass, givingCl ...

  2. 在微软平台上运行 SAP 应用程序

     本博客介绍了在微软平台上运行 SAP 应用程序的相关信息,作者在基于微软平台使用 SAP 方面有着数十年经验. 发布关于 Azure 的 SAP 说明 几个月前,SAP 针对适用于 SAP 软件 ...

  3. 用于防SQL注入的几个函数

    不要相信用户的在登陆中输入的内容,需要对用户的输入进行处理 SQL注入: ' or 1=1 # 防止SQL注入的几个函数: addslashes($string):用反斜线引用字符串中的特殊字符' & ...

  4. 阿里云 RDS 怎么保证高可用性

    RDS在系统构建之初,从网络到硬件再到系统都是基于高可用设计,他可以做到故障30秒无缝转移,对应用完全透明. 当一个数据库实例发生故障时, 另一个会立即顶上,而且对应用是完全透明的.你无需变更应用的连 ...

  5. C#调用Java代码

    c#直接调用java代码,需要ikvmbin-0.44.0.5.zip.下载地址: http://pan.baidu.com/share/link?shareid=3996679697&uk= ...

  6. 如何把一个表中的部分字段值插入到另一个表中去 这sql吊

    Insert into  JHAC_TB_CODE(CID,CODE,ADD_TIME,USERID,PRO_CODE,USERNAME)  select f_code.FID,f_code.Fcod ...

  7. HelloCharts pie饼图绘制

    先引用hellocharts-library-<version>.jar 然后在layout中设置 <lecho.lib.hellocharts.view.PieChartView ...

  8. 华为Oj 找出字符串第一个出现一次的字符

    #include <stdio.h> #include <string.h> char firstSingle(char *str) { int hash[255]={0}; ...

  9. iOS开发中遇到的一些问题及解决方案【转载】

    iOS开发中遇到的一些问题及解决方案[转载] 2015-12-29 [385][scrollView不接受点击事件,是因为事件传递失败] // //  MyScrollView.m //  Creat ...

  10. DTO学习系列之AutoMapper(六)----EntityFramework和AutoMapper的婚后生活

    写在前面 我到底是什么? 越界的可怕 做好自己 后记 文章标题主要关键字:mapping DTOs to Entities,注意并不是“Entities to DTOs”,表示实体对象到DTO的转换, ...