簡體   English   中英

反應由 CRA(create-react-app) 創建的 web 總是重定向到 '/'

[英]react web created by CRA(create-react-app) always redirect to '/'

我用 CRA 做了一個默認的反應 web 並啟動它。

並像這樣在地址欄中輸入任意路徑。

http://localhost:3000/whatever/path

我希望“無法獲取 /whatever/path”

但它總是重定向到'/'

為什么會這樣?

以及如何關閉此重定向設置?

Because it is standard with React apps to have this URL mapping you could change it using the URL mapping in backend say with DjangoRestFramework that is Async and for frontend web apps, and link it too the app but you're best leaving it as Facebook who做出反應這樣做: 在此處輸入圖像描述

因此,這不是一個問題,但如果您知道 django 或后端 web 框架,那么您是否可以更改它,這應該不是問題,它就像更改用於后端的任何語言的字符串一樣簡單其他后端方法也能夠做到這一點,而不僅僅是框架。

無論如何,只是一個本地服務器,直到集成一個后端。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM