Customize Custom Post Type URL

The problems that I face is already described in detail. As I guess that wordpress rewrite api can solve this problem so I have found that solution. I only have two main category for my posts so I map those to my properties because as I am removing custom_post_type name from url so there should be something to identify and map the url.

/**
 * Rewriting url
 */
function mak_rewrite_add_rewrites()
{

    // Mapping Property
    add_rewrite_rule(
        '^category_one_name(/[\S]*)+(/[\S]*)$',
        'index.php?property=$matches[2]',
        'top'
    );

    add_rewrite_rule(
        '^category_two_name(/[\S]*)+(/[\S]*)$',
        'index.php?property=$matches[2]',
        'top'
    );
}
add_action('init', 'mak_rewrite_add_rewrites');

$matches[2] represents to get value from second parenthesis in regular expression.