I’m writing a default .htaccess for a system that runs multiple JS app packages. I want to have URL rewrites that forward to run of these apps from the root (i.e. if the system is included at www/, www/appname/ should forward to server.index.php?app=appname).
Here’s roughly what I have now (I’ll skip the other stuff in my .htaccess).
RewriteRule ^use/?([^/]*)/?([^/]*)/?([^/]*)/? \server/index.php?app=$1&servable=$2&action=$3
RewriteRule ^web/?([^/]*)/? \server/index.php?servable=clients&action=web&app=$1
As you can see, I’m currently using two endpoints: use forwards to any action in the backend, while web forwards to the action that actually serves the application itself as an HTML document. I basically want to skip the web/ prefix in the URL in the latter case, but without hindering access to natural directories that already exist in the system’s directory.
Here’s full source. (As you can see there are probably other issues with my .htaccess as well, so if you have any pointers I’m happy to fix them.)
You can check that using the condition flags
-fand-d. So if you include these conditions right above the /web rule:meaning the requested URI doesn’t map to an existing file or directory, then:
except without the
/webpart.