Viewing 3 replies - 1 through 3 (of 3 total)
  • I guess you don’t need to use complex functions. Changing permalink structure on Dashboard should do the trick for you

    Thread Starter Crock

    (@magesh7)

    Thanks for ur reply @ashiquzzaman. I am not using this url to entire the site, I know If we change the permalinks on dashboard. globally it will change, i am not interest to change in permalinks. please teach me how can reach this by rewrite_rule or htacess

    Thread Starter Crock

    (@magesh7)

    add_action(‘init’, ‘category_rewrite’);

    function category_rewrite() {
    global $wp_rewrite;
    $rule = ‘cat/(.+?)/(\d+)/?$’;
    $rewrite = ‘index.php?year=$matches[2]&category_name=$matches[1]’;
    add_rewrite_rule($rule,$rewrite,’top’);
    $wp_rewrite->flush_rules();
    }

    Successfully Changed the URL From
    http://localhost/index.php?year=<year>&category_name=<catname&gt;

    to

    down vote
    accept
    Using the below code the following source url

    http://localhost/cat/<catname>/<year&gt;

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to rewrite the URL’ is closed to new replies.