• I’am actually having weird problems with add_rewrite_rule().

    As soon as i use index.php? in my 2nd argument regexp, the function fails writing anything in the .htacees file.:

    function qvs( $vars ){
     $vars[]= 'myvar';
    }
    add_action( 'query_vars, 'qvs' );
    function myrewrite(){
     add_rewrite_rule('something/([0-9]+), 'index.php?pagename=something&myvar=$matches[1]' );
    }
    add_action( 'init', 'myrewrite', 10, 0 );

    this simply doesn’t write any rule in the .htaccess file

    function myrewrite(){
     add_rewrite_rule('something/([0-9]+),'something/?myvar=$matches[1]' );
    }
    add_action( 'init', 'myrewrite' );

    A rewriteRule is written :

    RewriteRule something/([0-9]+) /a-wordpress-plugins-work/something/?myvar=$matches[1] [QSA,L]

    But it doesn’t work … still ending to my 404 page

    add_rewrite_rule('^something/([0-9]+), '/something/?myvar=$matches[1]' );

    Prints a weird rule that looks like this :
    RewriteRule ^^something/([\d]+) /a-wordpress-plugins-work//something/?myvar=$matches[1] [QSA,L]

    Of course none of these are working …

    Really need help for this !!!

    Thanks

The topic ‘add_rewrite_rule() weird behaviour’ is closed to new replies.