In general, the code from this question fit to me for 90%. One little change I need - I want all URL like example.com/snpv/any_text/ direct not to index.php as in original code, but to my.php script in root of my THEME (not site!). So, I correct the code for my needs:
register_activation_hook(__FILE__, 'make_flush_rules');
function make_flush_rules()
{
add_rewrite_rule('snpv/([^/]+)', '/wp-content/themes/lightsaber/my.php?prm1=$matches[1]', 'top');
flush_rewrite_rules(false);
}
add_filter('query_vars', 'make_query_vars');
function make_query_vars($query_vars)
{
$query_vars[] = 'prm1';
return $query_vars;
}
To make picture clear:
- lightsaber-my Theme
- my.php-just independent script. It is not page (or, to be precise, not WP page) or page template, just php-code to generate some output
I create this plugin and activate it. Enter URL example.com/snpv/ABC/ and get 404 page. :( How to correct problem? Thanks!