Angular 6 routes not found on Google App Engine

前端 未结 3 1071
予麋鹿
予麋鹿 2021-01-16 01:49

I deployed an Angular 6 application on Google App Engine. The app.yaml config looks like that:

runtime: python27
api_version: 1
threadsafe: true

skip_files:         


        
3条回答
  •  既然无缘
    2021-01-16 02:15

    The reason why 404 Not Found is showing on page refresh is that all Angular2 routes should be served via the index.html file.

    You can fix this issue by adding a .htaccess file (in the same directory where the index.html resides) with the following contents.

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

提交回复
热议问题