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';

         '^'. '/' .$category. '/' .$page_slug . '/' . $title,

        '^'. '/' .$category. '/' .$page_slug . '/page/([0-9]+)?/index.html',

What I want to achieve:

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

Apply: When the user is on the first page

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

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

Is it possible to do what I am looking for?

Thank you for your help!


I managed to solve it with a little javascript by doing this:

                window.history.replaceState(null, null, "");
                let  t = window.location.href;
                let s  = "";
                s = t;
                console.log("URL: "+s);
                   window.history.replaceState(null, null, s+"/index.html");

                        type: 'HEAD',
                        url: s,
                        success: function() {

                        error: function(jqXHR, status, exception) {
                           if(jqXHR.status == 404)
                              window.history.replaceState(null, null,s.split('/index.html')[0]);
                              window.location = s.split('/index.html')[0];


  • It looks like you would like to add index.html at the end of the default category link. Is that so? – nmr Jul 17 '19 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.