[英]How avoid 404 when using history API HTML5
您必須修改您的Web服務器並啟用mod_rewrite。 然后,服務器將處理該請求並將其轉發到您的索引文件,並且ember和SennaJS將按您期望的那樣解析URL。
對於Apache,您需要啟用mod重寫並編輯您的虛擬主機:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
和Nginx:
rewrite ^(.+)$ /index.html last;
參見: http : //readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.