开发者

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 '/'".)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜