Own code on index.php wordpress theme file, help with the rewrite rules

Your rewrite rules must not start with the first slash, that is already stripped out. So the following code will add a rewrite rule that will set a query variable that we can later use:

add_action( 'init', 'wpse9016_init' );
function wpse9016_init()
{
    add_rewrite_rule( 'currentpage/(\d+)/?', 'index.php?wpse9016_currentpage=$matches[1]', 'top' );
}

This query variable is ignored unless we add it to the list of public query variables:

add_action( 'query_vars', 'wpse9016_query_vars' );
function wpse9016_query_vars( $query_vars )
{
    $query_vars[] = 'wpse9016_currentpage';
    return $query_vars;
}

After you have done this, you can check for it and do whatever you want when it is set. A common use is to load a specific template file:

add_filter( 'template_include', 'wpse9016_template_include' );
function wpse9016_template_include( $template )
{
    if ( get_query_var( 'wpse9016_currentpage' ) ) {
        $template = locate_template( array( 'wpse9016_template.php' ) );
    }
    return $template;
}

Now, if you go to http://www.example.com/currentpage/2/, the file wpse9016_template.php in your theme directory will be loaded, where you can read get_query_var( 'wpse9016_currentpage' ) to get the current page number.

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş