在Apache Web服务器上部署Angular 4 App [英] Deploy Angular 4 App on Apache Webserver

查看:88
本文介绍了在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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆