Help with. htaccess: yii2 + angular 7

My current one .htaccess for yii2

        Options +FollowSymLinks
        IndexIgnore */*
        RewriteEngine on

        # Добавляем другой запрос /frontend/web/$1
        RewriteCond %{REQUEST_URI} !^/(frontend/web|backend/web|administrator)
        RewriteRule (.*) /frontend/web/$1

        # Если frontend запрос
        RewriteCond %{REQUEST_URI} ^/frontend/web
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /frontend/web/index.php

Now I want to switch to angular7, but get data from the controller api "https://домен/api/"

I.e. redirect everything except !^api on index.html (and files), keeping yii2 working

Author: blatube.com, 2019-03-24

1 answers

You can try to redirect all requests except for the api and files to index.html Something like:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_URI} !^/api$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt|svg|woff|ttf|eot)$
  RewriteRule . path/to/index.html [L]
</IfModule>
 0
Author: Kostiantyn Okhotnyk, 2019-03-25 15:14:50