I have a wordpress site with this personalized permalink:

http://sitename.com/%category%/%postname%/

and as category base I added a . (dot) to remove it, so I obtain:

http://sitename.com/categoryname/ 

and

http://sitename.com/categoryname/pagetitle

It works fine unless I have just one page in the category. While if I have the pagination, the link to page 2 becomes:

http://sitename.com/categoryname/page/2/

but it brings to a 404 page.

If I remove the dot to the base category, it works, but i get

http://sitename.com/category/categoryname/ 

instead of

http://sitename.com/categoryname/ 

Than I found this page
and added this code to the theme’s functions.php file:

function mg_news_pagination_rewrite() {
    add_rewrite_rule(get_option('category_name').'/page/?([0-9]{1,})/?$', 'index.php?category_name='.get_option('category_name').'&name=page&page=$matches[1]', 'top');

}

add_action('init', 'mg_news_pagination_rewrite');

But nothing happens. What am I doing wrong?

Moreover, the sites uses a plugin that adds the language code just after the domain name for not default languages (i.e. http://sitename.com/de/categoryname/ )

Thanks

Read more here: wordpress rewrite rule for personalized permalink


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: