$1 [QSA,L] 在我的 .htaccess 文件中是什么意思? [英] What does $1 [QSA,L] mean in my .htaccess file?

查看:30
本文介绍了$1 [QSA,L] 在我的 .htaccess 文件中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要更改我的 .htaccess 并且有两行我不明白.

I need to change my .htaccess and there are two lines which I don't understand.

RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

我什么时候应该使用这些行?

When I should use these lines ?

推荐答案

这里不是提供完整教程的地方,但这里是简述;

Not the place to give a complete tutorial, but here it is in short;

RewriteCond 基本上意味着执行下一个 RewriteRule只有当这是真的".!-l 路径是请求不是针对链接的条件(! 表示不是,-l 表示链接)

RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l path is the condition that the request is not for a link (! means not, -l means link)

RewriteRule 基本上意味着如果请求完成匹配 ^(.+)$ (匹配除服务器根目录之外的任何 URL),它将被重写为 index.php?url=$1 这意味着一个请求olle 将改写为 index.php?url=olle).

The RewriteRule basically means that if the request is done that matches ^(.+)$ (matches any URL except the server root), it will be rewritten as index.php?url=$1 which means a request for ollewill be rewritten as index.php?url=olle).

QSA 表示如果有一个查询字符串与原始 URL 一起传递,它将被附加到重写中(olle?p=1 将被重写为 index.php?url=olle&p=1.

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 表示如果规则匹配,则不再处理低于此规则的任何 RewriteRules.

L means if the rule matches, don't process any more RewriteRules below this one.

有关这方面的更完整信息,请访问上面的链接.重写支持可能有点难以掌握,但在 stackoverflow 上有很多示例可供学习.

For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.

这篇关于$1 [QSA,L] 在我的 .htaccess 文件中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆