0

I currently have all the permalinks for pages/posts on my site on my site rewritten to add .HTML to the structure. However, in an effort to avoid 301 redirects I would like to exclude the blog page from this.

I do not want to remove blog from the structure, I want it to return:

https://test.com/blog vs https://test.com/blog.html

I currently have the following code currently for rewrites:

add_action('init', 'html_page_permalink', -1);

function html_page_permalink() {

global $wp_rewrite;


if ( !strpos($wp_rewrite->get_page_permastruct(), '.html')){
    $wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html';
}

}

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.