I want to deploy Angular application in Apache sub directory. I added this .htaccess configuration:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /admin/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) index.html [NC,L]
</IfModule>
I used this command to compile the code:
ng build --prod --base-href /admin/
But when I open one page I get this error:
Error: Uncaught (in promise): e: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":404,"statusText":"Not Found","url":"http://185.185.185.185/admin/api/transaction_notes/unique_id/219","ok":false,"name":"HttpErrorResponse","message":"Http failure response for http://185.185.185.185/admin/api/transaction_notes/unique_id/219: 404 Not Found","error":"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /admin/api/transaction_notes/unique_id/219 was not found on this server.</p>\n<hr>\n<address>Apache/2.4.18 (Ubuntu) Server at 185.185.126.15 Port 80</address>\n</body></html>\n"}
Can you give me some advice how I can solve this isssue?
from Angular application cannot find files in sub directory
No comments:
Post a Comment