简体   繁体   English

如何在文件中传递9个以上的参数。 htaccess(mod_rewrite)?

[英]how to pass more than 9 parameters in the file. htaccess (mod_rewrite)?

我在使用mod_rewrite apache在.htaccess文件中花费超过9个参数时遇到了麻烦,例如,如果我传递参数$ 10 =“something”mod_rewrite传递参数$ 1的值。有没有解决方法?

The answer is simple: You cannot . 答案很简单: 你做不到

http://httpd.apache.org/docs/current/mod/mod_rewrite.html http://httpd.apache.org/docs/current/mod/mod_rewrite.html

The only thing you can do is to group some parameters into one and then parse it later in your script. 您唯一能做的就是将一些参数组合成一个参数,然后在脚本中解析它。

Of course, you can try splitting your pattern into 2 rules, so one rule matches 5 or 6 parameters, and then 2nd rule matches the rest (this will work because rules are executed one by one), but that will not always work (REALLY depends on actual rewrite rule, how complex it is) and requires good knowledge on what are you doing. 当然,您可以尝试将模式拆分为2个规则,因此一个规则匹配5个或6个参数,然后第二个规则与其余规则匹配(这将起作用,因为规则是逐个执行的),但这并不总是有效(真的取决于实际的重写规则,它有多复杂)并且需要对你在做什么有很好的了解。

RewriteRule backreferences: These are backreferences of the form $N (0 <= N <= 9), which provide access to the grouped parts (in parentheses) of the pattern, from the RewriteRule which is subject to the current set of RewriteCond conditions.. RewriteRule反向引用:它们是$ N(0 <= N <= 9)形式的反向引用,它提供对RewriteRule的模式的分组部分(括号中)的访问,RewriteRule受当前RewriteCond条件集的约束。 。

Source: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond 资料来源: http//httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM