0
Well I have a lodging with the following structure:
index.html
.htaccess
app
site
Well, inside the app folder I have an application compiled in Angular 7.0 and inside the site folder I also have a site made in Angular 7.0.
Good for the Angular routing to work I have to do the following configuration on htaccess
:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png)$ [NC]
RewriteRule ^(.*)$ /index.html?path=$1 [NC,L,QSA]
But I don’t want to have to create a htaccess
for each folder, I wanted to make all the settings in the htaccess
that is at the root.
I tried to do it this way:
# Configurações do url
<IfModule mod_rewrite.c>
RewriteEngine On
# Angular APP
RewriteBase /app/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png)$ [NC]
RewriteRule ^(.*)$ /app/index.html?path=$1 [NC,L,QSA]
# Angular Site
RewriteBase /site/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png)$ [NC]
RewriteRule ^(.*)$ /site/index.html?path=$1 [NC,L,QSA]
</IfModule>
But the htaccess
this only respecting the first configuration ( # Angular APP).
Is there any way to fix this?
It worked out, thank you.
– Hugo Borges
For nothing, basically removed the URL that is not in use
– Renato Tavares