n parameters in htaccess mod-rewrite rule
I need a rewrite rule that can handle any number of arguments, for example:
localhost/1/2/3/4/5/6/...
Is it possible to write开发者_StackOverflow社区 a rewrite rule for this? There´s no problem to collect them all in one parameter with braces to get PHP to handle them as a array if that would help.
Kind Regards
The easiest approach is going to look something like this:
RewriteRule ^([^/]*(/[^/]*)*)$ localhost?index.php?var=$1
You'll end up dealing with x/y/z in 'var', but without knowing the number of arguments ahead of time that's the best you can do.
(For clarification, [^/] means "any character except '/'".)
精彩评论