Forum Moderators: phranque

Message Too Old, No Replies

How many variables can I pass using RewriteRule?

         

twist

10:57 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Passing 4 variables works fine,

RewriteRule ^page/([0-9]+)/([0-9]+)/([0-9]+)?$ /example.htm?var1=var&var2=$1&var3=$2&var4=$3 [L]

This isn't working,


RewriteRule ^page/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)?$ /example.htm?var1=var&var2=$1&var3=$2&var4=$3&var5=$4 [L]

When I test, var5 equals nothing, the rest of the vars come through fine.

Any ideas?

twist

11:13 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nevermind, I found the problem.

I do have one further question though,

I've noticed certian words can't be used in the address string. So far sub and num seem to be part of a group of reserved words.

Is there a place to find a list of reserved words that don't work in .htaccess files?

jdMorgan

11:13 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mod_rewrite supports up to nine back-references, $1 through $9.

Since you have followed the last variable group in the RewriteRule pattern with a "?", the rule can match even if only three variables are present in the incoming URL, and var5 would be blank in that case.

Other than that, I see nothing out of the ordinary here.

Jim

twist

11:14 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the quick reply, any thoughts on my other question?