我用霓虹动画页面创建了不同的页面。
因此,当我使用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>
答案 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
即使在刷新