Angular-cli: ng build --prod router not working

Created on 25 Oct 2016  路  4Comments  路  Source: angular/angular-cli

dev model router is working;
but not working in dist directory with nginx server;

ex:
dev model:
locahost:4200/login working

prod model:
www.xxx.xx/login not working (dist directory)

angular-cli: 1.0.0-beta.18
node: 4.6.1
os: win32 x64

Most helpful comment

As mentioned, this is not related to the CLI. A quick search on SO lead to this question:
http://stackoverflow.com/questions/7027636/nginx-send-all-requests-to-a-single-html-page

All 4 comments

Hi,

If you use "apache server" to execute your prod env. You need to add rewrite rule into your htaccess like this

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

As mentioned, this is not related to the CLI. A quick search on SO lead to this question:
http://stackoverflow.com/questions/7027636/nginx-send-all-requests-to-a-single-html-page

@clydin thank you! you provide the link solve my question!

location / { try_files $uri /base.html; }

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brtnshrdr picture brtnshrdr  路  3Comments

hareeshav picture hareeshav  路  3Comments

5amfung picture 5amfung  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

delasteve picture delasteve  路  3Comments