在Apache Web服务器上部署Angular 4 App

编程入门 行业动态 更新时间:2024-10-24 22:18:13
本文介绍了在Apache Web服务器上部署Angular 4 App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在我的Apache Web服务器上部署Angular应用程序.我已经在我的/var/www/html 文件夹中添加了一个 .htaccess 文件,我尝试了几个base-hrefs.但是像许多人一样,我在路由方面也遇到了问题.我只能看到我的起始页",但是当我想转到另一个URL时,它将失败.我还能尝试什么,或者错过了什么?

I want to deploy my Angular Application on my Apache Webserver. I already added a .htaccess file to my /var/www/html folder, I tried several base-hrefs. But like many people I have problems with routing. I can only see my Startpage, but when I want to get to a other URL it fails. What else can I try or have I missed something?

推荐答案

您必须启用/安装Apache mod_rewrite 模块,然后将其放在您的 .htaccess 中>或您网站的apache配置:

You have to enable/install the Apache mod_rewrite module, and then put this in either your .htaccess or your apache configuration for your site:

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] </IfModule>

更多推荐

在Apache Web服务器上部署Angular 4 App

本文发布于:2023-10-31 12:50:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546136.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:器上   Web   Apache   Angular   App

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!