Support » Fixing WordPress » Custom rewrite to page but no url substitution

  • Hi

    I’ve got a strange problem. I have a page with follwing permalink
    /my-first-page ( id = 20 )

    Now i want to have another url /foo pointng to /my-first-page

    So i did some research on that and found following solution

    add_filter('rewrite_rules_array','wp_insertMyRewriteRules');
    add_action('init','flushRules');
    
    function flushRules(){
        global $wp_rewrite;
        $wp_rewrite->flush_rules();
    }
    
    function wp_insertMyRewriteRules($rules)
    {
        $newrules = array();
        $newrules['^foo$'] = 'index.php?p=20';
        return $newrules + $rules;
    }

    Thats just working but wp redirects to the url /my-first-page.
    I dont want wp to change my url rather i want to tell wp take this page id and show it under my custom url /foo

Viewing 3 replies - 1 through 3 (of 3 total)
  • So you are not in effect rewriting, you want to display the content from one page on anothe. You can do this with domains and it is know as Parking, but not sure if it is possible with single pages.

    Yes i want to show content from /my-first-page under /foo. Isn’t there any way to tell wp to do this. Can’t be that problem ?

    I want to do the same thing. In Buddypress I have a group that does not belong with the other groups. I want to give it its own url outside of the standard group permalink structure.

    Did you ever solve your problem?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom rewrite to page but no url substitution’ is closed to new replies.