• I know for posts you can have a fake .html ending in your permalinks, is this at all possible for pages too?

    Thanks in advance

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter pad

    (@pad)

    Anyone?

    Yes, it is posible.

    You can do it changing page_structure in WP_Rewrite::get_page_permastruct (wp-includes/rewrite.php) or hack it with a plugin:

    add_action('init', 'change_page_permalink', -1);
    function change_page_permalink() {
    	global $wp_rewrite;
    	if ( strstr($wp_rewrite->get_page_permastruct(), '.html') != '.html' )
    		$wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html';
    }

    How exactly do I change that?
    I tried several times, but each time resulting in some error.
    What part of the rewrite.php to I change/delete/overwrite?

    In my rewrite.php I see this:

    function page_rewrite_rules() {
    $uris = get_option(‘page_uris’);
    $attachment_uris = get_option(‘page_attachment_uris’);

    $rewrite_rules = array();
    $page_structure = $this->get_page_permastruct();
    if( is_array( $attachment_uris ) ) {
    foreach ($attachment_uris as $uri => $pagename) {
    $this->add_rewrite_tag(‘%pagename%’, “($uri)”, ‘attachment=’);
    $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure,

    EP_PAGES));
    }
    }
    if( is_array( $uris ) ) {
    foreach ($uris as $uri => $pagename) {
    $this->add_rewrite_tag(‘%pagename%’, “($uri)”, ‘pagename=’);
    $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES));
    }
    }

    return $rewrite_rules;
    }

    When I go to Options > Permalinks and create custom structure: %postname%.html — why doesn’t that work?

    Why do none of my posts of pages end with .html?

    What am I missing?

    Thread Starter pad

    (@pad)

    This doesn’t appear to work anymore!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Page permalinks – .html ending?’ is closed to new replies.