[wp-hackers] Creating custom rewrite rules

Andrew Ferguson andrew at fergcorp.com
Mon Feb 19 05:50:11 GMT 2007


http://blogs.oldradio.net/wp-content/plugins/custom_rewrite_rules_ver1.zip

-Andrew Ferguson

http://www.AndrewFerguson.net
http://www.fergcorp.com
http://www.StudentTabletPC.com

On 2/18/07, Callum Macdonald <lists.automattic.com at callum-macdonald.com>
wrote:
>
> G'day,
>
> Does anyone have a copy of the Custom Rewrite Rules plugin? The download
> link is dead.
> http://wp-plugins.net/plugin/custom_rewrite_rules/
>
> If not, I'm reading the WP_Rewrite function reference on codex:
> http://codex.wordpress.org/Function_Reference/WP_Rewrite
>
> and using the FeedDirector plugin as a starting point:
> http://boren.nu/archives/2005/03/29/feed-director-plugin/
>
> I'd like to add some custom rewrite rules to redirect
> /directory/pagename.htm to page_id = 2. Does that make sense? So
> siteurl.com/directory/pagename.htm will load the page with page_id 2 in
> WordPress.
>
> I've tried this code (modified from the Feed Director plugin:
> function feed_dir_rewrite($wp_rewrite) {
>     $feed_rules = array(
>         'index.rdf' => 'index.php?feed=rdf',
>         'index.xml' => 'index.php?feed=rss2',
>         'test.htm' => 'index.php&page_id=2',
>         '(.+).xml' => 'index.php?feed=' . $wp_rewrite->preg_index(1)
>         );
>
>         $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
> }
>
> The index.rdf and index.xml links work, but my test.htm link doesn't for
> some reason. Can anyone offer any suggestions?
>
> Cheers,
>
>
> Callum.
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list