Few days before, I made a big change on this website, which few of you might already have noticed. If you are for the first time on this website and you are coming via search engines, you might have noticed that the URL on the SERP is different from the URL of the page.Yes, I modified the permalink structure of this Blog with a new meaningful hierarchy.
In past, the post URL where like “www.htmlremix.com/post-name” which gives all the posts an equal value. But it was not having a hierarchy. So I decided to make it like “www.htmlremix.com/categoryname/post-name” . Just what I need to do is, change the permalink of post url to /%category%/%postname% . But I will lose all the traffic that which are linked to old URLs. So I tried so many plugins to redirect all those visitors to new URL. But most of them need to manually add the old and new ULR which is a massive job. Finally I found “Permalinks moved permanently” which automatically redirects both visitors and bots with a 301 permanent redirection header.
Now the category URLs are like “www.htmlremix.com/categoryname” which was like “www.htmlremix.com/category/categoryname” in old structure. That was annoying and the term category was absolutely wastage. I tried to use “Brianshoff” technique by adding one line code in the “wp-includes/template-functions-category.php”.
On line 36 of the wp-includes/template-functions-category.php file, you’ll see the code:
$catlink = str_replace(‘%category%’, $category_nicename, $catlink);
To remove “category” from the URL, simply add this line under it:
$catlink = str_replace(‘category/’, ”, $catlink);
At present the Bog is a perfect SEO Blog by means of link structure.