WP Rewrite the last two parts of the URL

I have finally solved my rewrite rule problem.
I used the class outlined in the answer of this wordpress.stackoverflow question. After including that class I used the following code to make it work:

 // These query vars can be retrieved on the page by using get_query_var( 'queryvar1' );
    $options = array(
            'query_vars' => array(
                'queryvar1',
                'queryvar2',
                'queryvar3',
                'queryvar4',
                'queryvar5',
                'queryvar6'
            ),
            'rules'      => array(
            'uncategorized/somename/([^/]+)/?$'=> 'index.php?p=1020&ident=$matches[1]'

            )
        );
        $rewrite = new AddRewriteRules( $options );
        add_action( 'wp_head', array(
            &$rewrite,
            'flush_rules'
        ) );
        add_action( 'generate_rewrite_rules', array(
            &$rewrite,
            'add_rewrite_rules'
        ) );
        add_filter( 'query_vars', array(
            &$rewrite,
            'add_query_vars'
        ) );

I hope this is useful for somebody with the same problem.

Leave a Comment

tech