The *
operator is greedy. This means that it will grab as much as it possibly can.
In your example, the first (.*)
block will match /funny/1
. The second one will match nothing at all, but that's OK because *
matches "zero or more" of the preceding character.
Using a different block to match the parts in between the slashes will do the trick. Something like this:
RewriteRule ^/avatars/([a-z]*)/([0-9]*)$ /avatars.php?genre=$1&page=$2
or this:
RewriteRule ^/avatars/([^/]+)/([^/]+)$ /avatars.php?genre=$1&page=$2
There's also no need for the ?
operator after the slashes as in order for there to be two variables, the slashes must be there.
Apache also has reluctant operators which are the opposite of greedy operators. You can use these by adding a question mark after a normally greedy operator. Like this:
RewriteRule ^/avatars/(.*?)/(.*?)$ /avatars.php?genre=$1&page=$2