php - Pretty URLs Based Off Tag In WordPress

one text

need to change the tag path, more seo like. atm my blog archive-page is like "domain.com/blog/", the same template (.php) is used for tags. Then the content that has this tag will be displayed accordingly. The URL here is then "domain.com/blog/?tag=tagname".

How can this be changed so that the path is then as follows: "Domain.com/blog/tag/tagname"?

I found this code in the blog.php.

if($_GET['tag']) {
    $tag = trim($_GET['tag']);
    $tag = str_replace(' ', '-', $tag);
}

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

if ($tag == "is_page") {
    $the_query = new WP_Query('cat=1,12&paged=' . $paged);
}
else{
    $the_query = new WP_Query('cat=1,12&paged=' . $paged . '&tag=' . $tag);
}

Source