For the site I need to do the following:

  1. from url of the form http://site.name/static/*** it is necessary to remove static , that is, http://site.name/static/css/styles.css should be read as http://site.name/css/styles.css
  2. URL http://site.name/api , http://site.name/static and http://site.name/admin to issue files located in the respective folders: api , static , admin ;
  3. all other requests are redirected to http://site.name/index.html .

For now, I do it like this:

 RewriteEngine on RewriteCond %{DOCUMENT_ROOT}/static%{REQUEST_URI} -f RewriteRule ^(.+) /static/$1 [L] RewriteCond %{REQUEST_URI} !^/api/ RewriteCond %{REQUEST_URI} !^/admin/ RewriteCond %{REQUEST_URI} !^/static/ RewriteRule .*? static/index.html 

However, if you make a request to, for example, http://site.name/css/test.css , but this file does not exist, then http://site.name/index.html opens, instead of issuing an error 404 , although it should . That is, I need to get errors from the static folder 404, 403 , etc. + static c url must be removed.

How can I do it? How many options did not try, it still does not work. Help me please.

    0