I was trying to get URLs edited in Apache as described below however I have not been successful.
If the URI starts with letter 'a' and third digit is not '7' with total digits are 6
then url http://example.com/a/123456/ should be rewritten to http://example.com/sixdigits.php
If the URI starts with letter 'b' and third digit is not '7' with total digits are 4 then url http://example.com/b/1234/ should be rewritten to http://example.com/fourdigits.php
Here is what I have tried with the .htaccess file.
RewriteRule ^a/[0-9]+/$ sixdigits.php
RewriteRule ^b/[0-9]+/$ fourdigits.php