リアクタがルータ名のon the react-router docsとして使用しようとしています。これは、base hrefが廃止されたためです。ここで ベース名が正しく動作しません
は、私が今持っているものです。import { Route, Router, useRouterHistory } from 'react-router';
import { createHistory } from 'history';
import { render } from 'react-dom';
var history = useRouterHistory(createHistory)({
basename: '/subdirectory'
});
render(
<Router history={history}>
<Route path='/' component={App}>
<Route path='next' component={Next} />
</Route>
</Router>,
document.getElementById('root')
);
(App
コンポーネントをレンダリング)予想通り、私はhttp://the-url.com/subdirectory
ページが読み込まに行くとき。しかし、http://the-url.com/subdirectory/next
に行くと404エラーが出ます。私のnginxの設定ファイルは次のとおりです。
location /subdirectory {
alias /path/to/index.html;
index index.html;
try_files $uri $uri/ /path/to/index.html;
}
これにはどのような解決策がありますか? – Jatin
誰にもこの解決策が見つかりましたか? –
これの解決方法はまだありますか? – stefanil