.htaccess ungreedy, possible ?

I am trying to get first directory path out of the REQUEST_URI when accessing the following :

domain.com/xxxx

or

domain.com/xxxx/yyy

or

domain.com/xxxx/yyy/zzz


using the .htaccess :

RewriteEngine on
Options +FollowSymlinks

RewriteCond %{REQUEST_URI} ^(.+)?/(.*)$ [NC]
RewriteCond %{REQUEST_URI} !test [NC]
RewriteRule ^.*$ /test/index.php?uri=%1 [L]

but the result in the uri is always :

Array
(
[0] => uri=/xxxx/yyy/zzz
)

when i only want it to be /xxxx

does anyone have a solution to this problem?

And yes, i need it to be done outside PHP, for a more complex .htaccess file.

 

 

 

 

Top