1public function mypage_rewrite_ext() {
2 global $wp_rewrite;
3 $plugin_url = plugins_url( 'mypage.php', __FILE__ );
4 $plugin_url = substr( $plugin_url, strlen( home_url() ) + 1 );
5 // The pattern is prefixed with '^'
6 // The substitution is prefixed with the "home root", at least a '/'
7 // This is equivalent to appending it to `non_wp_rules`
8 $wp_rewrite->add_external_rule( 'mypage$', $plugin_url );
9}