r3m4k3
r3m4k3

Reputation: 182

Angular and symfony in one dir - htaccess

I have following problem, I have in folder /var/www/html 2 dirs: app (angular application) and api(restful api and cms written in symfony3). In both directories there is appropriate htaccess for each application. The document root is /var/www/html and I need the website to be redirected to app/index.html, and only /api/ to api subfolder. But I can't get this working with symfony htaccess.

Angular htaccess is default provided. Symfony htaccess:

DirectoryIndex app.php
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ - [L]
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

    RewriteRule ^bundles/(.*)$ /web/bundles/$1 [L]
    RewriteRule ^uploads/(.*)$ /web/uploads/$1 [L]
    RewriteRule ^assetic/(.*)$ /web/assetic/$1 [L]
    RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
    RewriteRule ^js/(.*)$ /web/js/$1 [L]
    RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
    RewriteRule ^backend/fonts/(.*)$ /web/backend/fonts/$1 [L]
    RewriteRule ^backend/img/(.*)$ /web/backend/img/$1 [L]
    RewriteRule ^fonts/(.*)$ /web/fonts/$1 [L]
    RewriteRule ^thumbs/(.*)$ /web/thumbs/$1 [L]
    RewriteRule ^ %{ENV:BASE}/web/app.php [L]
</IfModule>

Any idea how to get this done?

Upvotes: 1

Views: 585

Answers (1)

Robert
Robert

Reputation: 3483

HI can you check this one

apache.conf

<VirtualHost *:80>
    ServerName test.io
    DocumentRoot yourporjectpath/web/

    #Include conf-available/serve-cgi-bin.conf
    <Directory yourprojectpathe/web/ >
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
            Require all granted


            RewriteEngine On
            RewriteCond %{HTTP:Authorization} ^(.*)
            RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
            RewriteCond %{REQUEST_FILENAME} -s [OR]
            RewriteCond %{REQUEST_FILENAME} -l [OR]
            RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule ^.*$ - [NC,L]
            RewriteRule ^(.*) /index.html [NC,L]
    </Directory>

also check ss of .htaccess .htaccess

Upvotes: 1

Related Questions