How to create custom URL routes? and get url in wp php plugin

    // route
    add_action( 'init', array($this, 'wpse26388_rewrites_init') );
    add_filter( 'query_vars', array($this, 'wpse26388_query_vars') );

    function wpse26388_rewrites_init(){
        add_rewrite_rule(
            'properties/((0-9)+)/?$',
            'index.php?pagename=properties&property_id=$matches(1)',
            'top' );
    }
    
    function wpse26388_query_vars( $query_vars ){
        $query_vars() = 'property_id';
        return $query_vars;
    }