[wp-hackers] WP Rewrite
eric at eam.me
Sun Feb 20 04:50:14 UTC 2011
I've also asked this over on the WordPress Stack Exchange ... let's see who
answers first :-)
I'm trying to create a custom API endpoint in WordPress, and I need to
redirect requests to a virtual page in the root of WordPress to an actual
page that ships with my plug-in. So basically, all requests to the one page
are actually routed to the other.
The point of this is to make the url for the API endpoint as short as
possible (similar tohttp://mysite.com/xmlrpc.php but to ship the actual API
endpoint file with the plug-in rather than requiring the user to move files
around in their installation and/or hack core.
My first stab was to add a custom rewrite rule. However, this had two
1. The endpoint always had a trailing slash. It became
2. My rewrite rule was only ever partially applied. It wouldn't redirect
to wp-content/plugins..., it would redirect to
index.php&wp-content/plugins.... This lead to WordPress displaying either
a page not found error or just defaulting to the homepage.
More information about the wp-hackers