I want to send unlimited number of variables within mod_rewright
I used this rule to send three variables :
PHP Code:RewriteRule ^([-a-zA-Z0-9\ \-\+\_\?]+)$ index.php?var1=$1
RewriteRule ^([-a-zA-Z0-9\ \-\+\_\?]+)/$ index.php?var1=$1
RewriteRule ^([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_]+)$ index.php?var1=$1&var2=$2
RewriteRule ^([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_]+)/$ index.php?var1=$1&var2=$2
RewriteRule ^([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_\/\*]+)$ index.php?var1=$1&var2=$2&var3=$3
RewriteRule ^([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_\/\*]+)/$ index.php?var1=$1&var2=$2&var3=$3
when I wanted to send 4 , I added the variable and its rule after the previous one , but this didn't work properly ...
PHP Code:RewriteRule ^([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_\/\*]+)/([-a-zA-Z0-9\ \-\+\_\/\*]+)$ index.php?var1=$1&var2=$2&var3=$3&var4=$4
RewriteRule ^([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_]+)/([-a-zA-Z0-9\ \-\+\_\/\*]+)/([-a-zA-Z0-9\ \-\+\_\/\*]+)/$ index.php?var1=$1&var2=$2&var3=$3&var4=$4
when requesting a link such as :
http://site.com/1st/2nd/3rd/4th/5th
The result of print_r function was :
PHP Code:Array ( [var1] => 1st [var2] => 2nd [var3] => 3rd/4th/5th )
I know that this method is very silly , and it proofed that !
what if I want to send 40 variables and using the modrewright engine with them ???







Bookmarks