I would like to add a rewrite Condition in my htaccess that would be true if calling a php file returns "true" or false otherwise. I' am using the -U switch in my RewriteCond to run a subrequest and if the condition is not satisfied, the PHP script returns a 404 error, which triggers the rewriteCond.
My goal is to run a URL shortening service in parallel with a PHP website.
Here is my current .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond /smallurl/%{REQUEST_URI} !-U
RewriteRule (.*) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) smallurl/$1 [L]
What is the best practice to achieve something like this? Recomendations, things I should be aware of? Is there a way to avoid the subrequest, or at least speed it up?
Thank you