Angular provides a standard .htaccess
to be used in Angular applications.
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
It is useful for routes to be accessible via direct access or refresh.
However, a directory that is within the same Angular directory is always redirected to index.html.
This directory contains the API in CodeIgniter 3 that is called by the Angular application.
And it is located in /example.com/api/...
Everything in the root of example.com
is Angular’s html and JS.
How do I stop .htaccess
from redirecting when there is /api/ in the URL?
Eg: /api/index.php/controller/method