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)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom rewrite to page but no url substitution’ is closed to new replies.