访问root时的htaccess行为

I've been using this htaccess code to pass on vars to redirect.php which handles the includes for me:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*)/(.*)/(.*)$ redirect.php?value1=$1&value2=$2&value3=$3 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*)/(.*)$ redirect.php?value1=$1&value2=$2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*)$ redirect.php?value1=$1 [L,QSA]

but i noticed that it will not go to redirect if all arguments is empty, so if i go to http://domain.com/ it will open index.php, but if i go to http://domain.com/any-param/ redirect.php handles it correctlty. How can I make it always use redirect.php as default, even when no additional URL parameters is set?

Your rules appear to be fine to me. Just add this line in the end:

RewriteRule ^$ redirect.php [L]

This will redirect http://domain.com/ to http://domain.com/redirect.php.

use to do it like this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([a-z]+)?/?([a-z]+)?/?([-a-z0-9]+)?/?$ [NC]
RewriteRule ^([a-z]+)/?([a-z]+)?/?([-a-z0-9]+)?/?$ /redirect.php?value1=$1&value2=$2&value3=$3 [NC,L]

Note: Even with only 1 param, this will still work as it just leaves the other 2 blank. So you don't have to copy and paste thew same code while removing just one condition.

I found that this is not very scalable. Now I just redirect everything to the index.php and let that file fetch and dissect the URI to handle my system layout. This allows for a very scalable system.