Without sitting down and trying it, I would guess that the problem is that
http://www.domain.com/post/comments/43 actually matches both rules and as a result that type of url is being handled by your last rule.
You can use the 'L' flag on your first rule which should solve the problem. The 'L' flag basically equates to ..... 'If this rule is matched stop here do not check any further rules'. So.....
Code: Select all
RewriteRule ^(.*?)/(articles|comments)/(ї0-9]+)$ /?page=$1&mode=$2&id=$3 їL]
RewriteRule ^(.*?)/(ї0-9]+)$ /?page=$1&id=$2
...should fix the problem. There is no need to use the 'L' flag after the second rule as that is the last rule anyway.
On a side note, I've never been too convinced about the integrity of the regex parser used for mod_rewrite, I have had problems in the past using the '.*?' notation (it has caused 'Internal Server Errors' on older versions) so much so I now actively avoid it. Personally I would be more inclined to write the rules like.....
Code: Select all
RewriteRule ^(ї^/]+)/(articles|comments)/(ї0-9]+)$ ?page=$1&mode=$2&id=$3 їL]
RewriteRule ^(ї^/]+)/(ї0-9]+)$ ?page=$1&id=$2