• Hi,
    I have problem with url rewrites in wordpress.

    I have activated premalinks from admin site, now the url structure is like : localhost/wordpress/page_name.
    I have created one plugin named garden, It is creating one peage in frontend named garden.
    Now i can access the page like : localhost/wordpress/garden. and with parameter like localhost/wordpress/garden/?garden_id=205.
    I have tried so much to create urls lke localhost/wordpress/garden/garden_name/ — or — localhost/wordpress/garden/205/ . but there is always an error “page not found”.
    (I want to use same page to display different information according to the received parameters )
    I understand using /205/ or /garden_name/ will not display the result but atleast it should not give “page not foung error”.

    Now my need is i to display urls like localhost/wordpress/garden/garden_name/.

    add_action( 'init', 'add_garden_rules' );
    
    function add_garden_rules() {
      add_rewrite_rule("^garden/([^/]*)/([^/]*)/?","index.php?page_id=345&garden_id=$matches[1]&variety=$matches[2]",'top');
    }

    Please help me if anybody can.

    I am waiting for a valuable reply.

    Thanks,

    [sig moderated as per the Forum Rules]

  • The topic ‘custom url rewrite’ is closed to new replies.