I am trying to make a scalable RewriteRule on my .htaccess, I use each word before slash as a parameter.
for example: http://localhost/mysite/param1/param2/param3/.../param20
I am working with this code (but if I want 6 o 7 parameters, it would be too long):
Options +FollowSymLinks
RewriteEngine on
DirectoryIndex web.php?param1=inicio
RewriteRule ^([a-zA-Z0-9_-]+)$ web.php?param1=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ web.php?param1=$1¶m2=$2
Next rewriteRules would be longer ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$/([a-zA-Z0-9_-]+)$/([a-zA-Z0-9_-]+)$/([a-zA-Z0-9_-]+)$ web.php?param1=$1¶m2=$2¶m3=$3¶m4=$4¶m5=$5
I send each parameter to php as an indivudal variable, and I use the first parameter to decide wich page must be shown on web.php. Is there any way to make it shorten? I don't know how to optimize it. I don't even know if I am on the right way. How would you make it? Maybe using php? Thanks.