重新加载页面聚合物1.0时出错

时间:2018-02-05 19:29:32

标签: polymer polymer-1.0

我用霓虹动画页面创建了不同的页面。

因此,当我使用href转到页面时它可以正常工作,但是当我尝试重新加载页面时,我遇到了404错误。

这是我的app.html

<app-location route="{{route}}" use-hash-as-path></app-location>
    <app-route
            route="{{route}}"
            pattern="/:view"
            data="{{routeData}}"
            tail="{{subroute}}">
    </app-route>
    <div class="container flex-vertical">
        <app-header id="header">
            <neon-animated-pages selected="[[routeData.view]]" attr-for-selected="name" fallbackSelection="home" class="fit" selected-attribute="reload">
                <app-home-page name="" route="{{subroute}}"></app-home-page>
                <app-profil-page name="profil" route="{{subroute}}"></app-profil-page>
                <app-setting-page name="settings" route="{{subroute}}"></app-setting-page>
            </neon-animated-pages>
        </app-header>
    </div>

1 个答案:

答案 0 :(得分:0)

您必须设置.htaccess文件。例如我的

<filesMatch "\.(js)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule .* /index.html [L]

filesMatch规则对您来说并不重要,因此您可以跳过它。我只需要阻止在服务器端缓存一些文件。

.htaccess将所有路由重定向到index.html或您选择的任何路径。然后app-route即使在刷新

之后也会处理路由