[英]I change (rewrite) URL with jquery but when user or I refresh the page, we get 404 not found error
我像這樣重寫 URL,
history.pushState('data', '', 'http://radyospor.fstats.net/Galatasaray-Bursa');
一切都很好,但在刷新頁面時重寫 url 后,我得到:
“HTTP 錯誤 404.0 - 未找到您要查找的資源已被刪除、更名或暫時不可用。”
我該如何解決?
假設您的主頁位於以下 URL: http://radyospor.fstats.net/
: http://radyospor.fstats.net/
當您瀏覽到該 URL 時,服務器會返回位於其 Web 根目錄中的index.html
文件。
當您調用history.pushState
,不會調用服務器,但更改了 URL。
在history.pushState
之后刷新時,URL 現在是http://radyospor.fstats.net/Galatasaray-Bursa
,服務器將其解釋為對 Web 根目錄中名為Galatasaray-Bursa
的文件的請求。
此文件不存在,因此您會收到 404。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.