How can I make clean URL's with one, two OR three variables?
I want domain.com/mypage to direct to index.php?page=mypage and domain.com/mypage/myproduct to redirect to index.php?page=mypage&var2=myproduct and domain.com/mypage/myproduct/detail to redirect to index.php?page=mypage&var2=myproduct&var3=detail. So some pages have three variables, others have only one or two.
This is the .htaccess I'm using (it includes a part I found at htaccess rewrite pass two variables or one depending if both are available?):
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^([^/]+)(/([^/]+))? index.php?page=$1&var1=$3 [L,QSA]
It's working for links with one or two variables. How can I make it work for three (or more) variables.