I have a re-write rule in .htaccess (it’s working fine) that I’d like to add as WordPress wp_rewrite –
mainly for portability and user’s convenience… The question is just how the regex-pattern has to look like…
RewriteCond %{REQUEST_URI} ^/services/rest/(.*)$
RewriteRule ^(.*)/(.*)/(.*)$ wp-content/plugins/some_plugin/api.php?action=$3 [L,NC]
The syntax that I would require looks about like this:
$newrules = array('^/services/rest/(.*)' => mAPI_PLUGIN_URL.'/socket.php?action=$matches[1]');
Any suggestions how to solve or how to improve that?
Add the following code in your script/theme:
In my case it is working good for a plugin I have developed for personal use.