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

情到浓时终转凉″ 提交于 2019-12-22 08:31:38

问题


I'm having trouble spending more than nine parameters in. htaccess file with mod_rewrite apache, for example, if I pass the parameter $ 10 = "something" mod_rewrite passes the value of parameter $ 1. Is there any solution for this?


回答1:


The answer is simple: You cannot.

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:


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..

Source: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond



来源:https://stackoverflow.com/questions/10982087/how-to-pass-more-than-9-parameters-in-the-file-htaccess-mod-rewrite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!