问题
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?
回答1:
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>
回答2:
Uncomment this line at "/etc/apache2/httpd.conf"
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so
To
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
来源:https://stackoverflow.com/questions/47302373/deploy-angular-4-app-on-apache-webserver