External rewrite rules are awesome. They let you define rewrites that don't necessarily pass through WordPress'
index.php. This means you can map arbitrary rules to arbitrary files like:
$wp_rewrite->add_external_rule( '^somethingrandom/?$', 'wp-content/wp-uploads/hiddendirectory/somefile.php' );
Then, any request to
http://site.url/somethingrandom/ will actually be served a static PHP file from a different directory. This is amazing, and it lets you do all sorts of nifty stuff.
But it only works with Apache.
add_external_rule() method writes its registered rules out to
.htaccess. Since Nginx doesn't use an
.htaccess file, external rules are completely ignored by that server. What I need is a server-independent way to programatically register rules like the one above. Any ideas?