I'm working on an application using Angular4
and PHP
, so that the URL of the Angle works, I need to use a certain setting in .htaccess
to point to index.html
, like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
So far, everything works as it should, I can access and refresh on any page without any problems. However, I also want to use the routing system in PHP
, so I need another type of configuration to direct the calls to the index.php
, which is in another folder. The project directory looks something like this:
raiz
│ index.html
│ vendor.bundle.js
| [outros arquivos .js]
│
└─api
│ │ index.php
│ │ init.php
│ │
│ └─vendor
└─assets
└─[outros arquivos]
And this is the setting to make the% path system work:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . api/index.php [L]
</IfModule>
The problem is that I can not get both of them working at the same time. Or the route works in PHP
or Angular
, but not both together.
The routes in PHP
need to be directed to the file PHP
only when I call some url that contains the string /api/index.php
, that is, always have the prefix /api/'alguma-coisa'
.
How can I fix this problem and use both routing systems?
... or, if there is another solution, I can use it quietly as long as I reach the end goal.