Custom rewrite rule help

I am trying to solve a rewriting issue. Basically

After quite a bit of research, I came up with this custom rewrite rules:

$category = ‘category’;
$page_slug = ‘florida’;
$title = ‘index.html’;

add_rewrite_rule(
‘^’. ‘/’ .$category. ‘/’ .$page_slug . ‘/’ . $title,
‘index.php?page_id=’.$page_id,
‘top’
);

add_rewrite_rule(
‘^’. ‘/’ .$category. ‘/’ .$page_slug . ‘/page/([0-9]+)?/index.html’,
‘index.php?page_id=’.$page_id,
‘top’
);

What I want to achieve:

From: http://domain.com/category/someCategory/
To: http://domain.com/category/someCategory/index.html

Apply: When user is on first page

From: http://domain.com/category/florida/page/n
To: http://domain.com/category/florida/page/n/index.html

Apply: When user is on (n>1) page

Is it possible to do what I am looking for?

Thank you for your help!

Read more here:: Custom rewrite rule help

Leave a Reply

Your email address will not be published. Required fields are marked *