WordPress.org

Ready to get started?Download WordPress

Forums

Rewrite a specified page permalink (2 posts)

  1. Andreas H
    Member
    Posted 6 years ago #

    Hi, guys, wondering if anyone could give be a kick in the right direction!?

    I want to do this:

    Change the permalink of a specified page from http://www.mysite.com/mypage/ to http://www.mysite.com/mypage.htm

    ...and that because I want to reuse the pagerank that already exist for http://www.mysite.com/mypage.htm

    ...and I want to do that for that page ONLY!

    I've found this plugin that adds a html extension to ALL the pages pemalink, the code:

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

    So, changing the .html to .htm would do the trick, except it changes all the pages permalinks, is their any way to modifie the plugin code to just rewrite the permalinks for the page/pages I want to?

    Or do I have to add a rewrite rule in the .htaccess!? (If that's even possible, I'm not very familiar with that)

    All help would be appreciated! Thanks!

  2. Andreas H
    Member
    Posted 6 years ago #

    Anyone!?

Topic Closed

This topic has been closed to new replies.

About this Topic