I have Apache server which is running Angular 6 application under /var/www/html/<angular_root>
. I tried to add one folder /var/www/html/admin/<angular_root>
but I get errors Failed to load resource: the server responded with a status of 404 (Not Found)
. Do you know what configuration I need to implement?
My current apache configuration is:
<Directory /var/www/html/admin>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
4
Answers
Here is my working example:
Where
dist/browser
is a generated sources withindex.html
Your angular project(s base href is wrong.
when you deploy your application, specify base-href on the cmdline :
for reference https://angular.io/guide/deployment
You need to add rewrite rules to .htaccess. Otherwise the requests to your routes won’t be redirected back to index.html for rendering.
Look at the following link for
Apache deployment: https://angular.io/guide/deployment
One of my project which was on
tomcat
server, I have done the following:src/WEB-INF
.WEB-INF
folder createweb.xml
with below code.angular.json
build > assets section, when you build your project it will get copied to final./dist
folder.index.html
file<base href="./">
Hope this will helps someone.