## Getting URL Variables with a Rewritten Page (Login Page)

Question

As part of a larger project, I am attempting all login activity to occur at the following address:

So, a link that should lead to a form that would allow a user to reset their password would be found at the following:

However, the wp-login.php is not reading this correctly, and when I go to the above address, I get the normal log-in form.

This is how I have it set up:

add_action( 'init', 'add_virtual_page_template' );
{
global $wp,$wp_rewrite;

$wp->add_query_var( 'template' ); add_rewrite_endpoint( 'login', EP_PERMALINK | EP_PAGES ); add_rewrite_rule( 'login/?', 'index.php?template=login', 'top' ); add_rewrite_rule( 'login/?', 'index.php?template=login', 'top' );$wp_rewrite->flush_rules();
}

{
global $wp;$queryvar = get_query_var('template');

if ($queryvar &&$queryvar == 'login')
{
exit();
}