3
I have an application in AngularJs
with html5
enabled, which makes me need to use the module rewrite
apache so there is a correct URL conversion.
I have no problem using this when accessing the application with index from the root, ie if I access www.meusite.com.br
and browse the menus, refresh the page, etc. everything works correctly.
The problem starts when I need to access a new area of app
that starts in a subfolder, for example my administrative area. It gets all stored in a subfolder called adm
being accessed like this: www.meusite.com.br/adm
In this Adm subfolder, I have a new index, new subfolders, etc. A new area of app
focused only on administration and this is the part where I have problems using the module rewrite
with html5
, because when updating the page it no longer finds the path, in case it tries to start from the root index.
This is my file .htaccess
located at the root of app
.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
In theory I know I would need a rule that points to the subfolder as well, but I don’t know how to create this rule and also I haven’t been able to find anything so far.
but this will not 'overwrite' what was set in the other . htaccess ? Why I need to access the two areas equally. Or this htaccess would be to put inside the sub folder 'Adm' ?
– celsomtrindade
This you create inside the subfolder. In this case will not interfere with each other.
– Diego
Still, the first access is ok, but when I refresh the page it goes back to the index located at the root, not in the folder 'Adm'
– celsomtrindade
That, I put the one of your answer inside the Adm folder and kept the one of my question in the root folder.
– celsomtrindade
I changed the last line, see if it’s right now.
– Diego
Perfect, thank you very much! I had tried something similar to this, but I don’t understand the correct logic of htaccess files, now it’s become clearer how it works too, vlw!
– celsomtrindade