WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Excluding one page from permalink rewrite?

[Resolved] Excluding one page from permalink rewrite?

  • I’m converting an old static site to wordpress and want to keep the same urls and titles for seo purposes. The plugin “.html in pages” is the perfect thing.

    Just wondering how I might exclude one page from having the .html ending. I have created a static landing page and want the blog functionality to be on a “blog” page. I want the url for the blog page to be “http://www.mysite.com/blog/” instead of “”http://www.mysite.com/blog.html/”

    Here is the code I’m looking at:

    function html_page_permalink() {
    global $wp_rewrite;
    if ( !strpos($wp_rewrite->get_page_permastruct(), ‘.html’)){
    $wp_rewrite->page_structure = $wp_rewrite->page_structure . ‘.html’;
    }
    }
    add_filter(‘user_trailingslashit’, ‘no_page_slash’,66,2);
    function no_page_slash($string, $type){
    global $wp_rewrite;
    if ($wp_rewrite->using_permalinks() && $wp_rewrite->use_trailing_slashes==true && $type == ‘page’){
    return untrailingslashit($string);
    }else{
    return $string;
    }
    }

    function active() {
    global $wp_rewrite;
    if ( !strpos($wp_rewrite->get_page_permastruct(), ‘.html’)){
    $wp_rewrite->page_structure = $wp_rewrite->page_structure . ‘.html’;
    }

    Isn’t there something like a “&exception=” that I can stick in somewhere? I’m on a learning curve with php and if someone could help me out, I’d be much obliged.

    Cheers.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Excluding one page from permalink rewrite?’ is closed to new replies.
Skip to toolbar