WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Excluding one page from permalink rewrite? (3 posts)

  1. J. Brown
    Member
    Posted 2 years ago #

    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.

  2. ceo
    Member
    Posted 2 years ago #

    I'm not sure on the code, but an option to keep your blog at /blog/ might be to just create a multisite using sub-directories and install a second blog at your desired directory. All the information is here.

    (Of course, now that I've bumped this someone may well come along with the line of code you need.)

  3. J. Brown
    Member
    Posted 2 years ago #

    Appreciate you taking a moment. Solved the problem with this:
    http://wordpress.org/extend/plugins/custom-permalinks/
    Now, I can make the permalink whatever I want on whatever page or post. Gotta love wordpress. Cheers.

Topic Closed

This topic has been closed to new replies.

About this Topic