Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs React服务器端呈现-支持hashbang_Reactjs_React Router_Server Side_React Starter Kit - Fatal编程技术网

Reactjs React服务器端呈现-支持hashbang

Reactjs React服务器端呈现-支持hashbang,reactjs,react-router,server-side,react-starter-kit,Reactjs,React Router,Server Side,React Starter Kit,我将我的网站从一个有角度的客户端网站移植到服务器端渲染。我用的是反应启动套件 我的客户有使用hashbang表单的旧链接。 如何在新应用程序中支持这些旧链接 e、 g我想将所有mydomain.com/#/path/to/page重定向到mydomain.com/path/to/page服务器从未看到hashbang路由。我认为您不能仅通过服务器端渲染来支持这些旧链接。您必须在客户端上运行一些与Yura的答案类似的代码。我最后向客户端添加了一些代码,请参阅我对Yura答案的评论。谢谢,我接受了您

我将我的网站从一个有角度的客户端网站移植到服务器端渲染。我用的是反应启动套件

我的客户有使用hashbang表单的旧链接。 如何在新应用程序中支持这些旧链接


e、 g我想将所有
mydomain.com/#/path/to/page重定向到
mydomain.com/path/to/page

服务器从未看到hashbang路由。我认为您不能仅通过服务器端渲染来支持这些旧链接。您必须在客户端上运行一些与Yura的答案类似的代码。我最后向客户端添加了一些代码,请参阅我对Yura答案的评论。谢谢,我接受了您的答案并根据我的需要对其进行了修改:if(location.hash.indexOf('#')==0{location.pathname=location.hash.replace('#','')location.hash=“”历史记录。替换(位置);}
if(location.hash.indexOf('#')===0) {
    location.href = location.hash.replace('#','') 
}