Quiero crear una aplicación Angular que se ejecute en el servidor Apache. Localmente, desde npm start , funciona bien, pero desde la implementación remota de Apache faltan muchos archivos. Traté de configurar fuentes y archivos i18n en la carpeta src/assets/.... en angular.json :
"assets": [ "src/favicon.ico", "src/assets", "src/web.config" ],Pero cuando ejecuto la página web obtengo errores como:
633328.png:1 Failed to load resource: the server responded with a status of 404 (Not Found) materialdesignicons-webfont14e6.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found) fontawesome-webfont3295.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found) fontawesome-webfont3295.woff:1 Failed to load resource: the server responded with a status of 404 (Not Found) materialdesignicons-webfont14e6.woff:1 Failed to load resource: the server responded with a status of 404 (Not Found) fontawesome-webfont3295.ttf:1 Failed to load resource: the server responded with a status of 404 (Not Found) materialdesignicons-webfont14e6.ttf:1 Error al cargar el recurso: el servidor respondió con un estado de 404 (No encontrado)
Entonces, después de la investigación, parece que tengo que agregar mapeo usando esto: https://www.thewebflash.com/set-the-correct-mime-types-for-woff-fonts-in-your-web-server/ pero no es trabajando. También traté de agregar esta configuración:https://gist.github.com/vmilev/cf8ef05c2d77fc8aedd6c5831d724a77
Pero de nuevo sin suerte. ¿Puedes darme alguna idea de cómo se puede arreglar esto?
archivo .htaccess
RewriteEngine On # If an existing asset or directory is requested go to it as it is RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d RewriteRule ^ - [L] # If the requested resource doesn't exist, use index.html RewriteRule ^ /index.html <IfModule mod_rewrite.c> Options Indexes FollowSymLinks RewriteEngine On RewriteBase /angular/ RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.html [L] </IfModule> AddType font/woff .woff AddType font/woff2 .woff2simplemente agregue una barra en estilos.css antes de las direcciones URL. Cambiar de esto
angular/assets/fonts/glyphicons-halflings-regular.eota esto
/angular/assets/fonts/glyphicons-halflings-regular.eot