【问题标题】:error to reloading page polymer 1.0重新加载页面聚合物 1.0 时出错
【发布时间】:2018-02-05 19:29:32
【问题描述】:

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

因此,当我使用 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>

【问题讨论】:

    标签: polymer polymer-1.0


    【解决方案1】:

    您必须设置您的.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 将在刷新后处理路由

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-11
      • 2015-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多