`query_var` values empty in theme file after `add_rewrite_rule` redirection

Changing the add_rewrite_rule did the trick:

add_rewrite_rule('^periodicals/([^/]+)-'.$tlv['code'].'[/]?$', 'index.php?periodicals=$matches[1]&post_type=periodicals&name=$matches[1]&mlang='.$tlv['code'], 'top');

So, I assume for custom post types, using add_rewrite_rule with index.php as query need some extra query variables. A sample will be as:

add_rewrite_rule('^<custom_post_type>/([^/]+)-'.$tlv['code'].'[/]?$', 'index.php?<custom_post_type>=$matches[1]&post_type=<custom_post_type>&name=$matches[1]&mlang='.$tlv['code'], 'top');

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)