相关疑难解决方法(0)

如何设置AllowOverride all

我想设置AllowOverride all但我不知道该怎么做.我通过搜索谷歌找到了以下代码并将其粘贴在.htaccess中

<Directory>
        AllowOverride All
</Directory>
Run Code Online (Sandbox Code Playgroud)

但在粘贴之后我开始收到了 .htaccess

可以任何人指导我在哪里放置此代码或如何做到这一点?

apache .htaccess

144
推荐指数
8
解决办法
47万
查看次数

如何使用react-router在浏览器中停止/#/?

/#/使用react-router时,有什么方法可以阻止在浏览器的地址栏中显示?这与ReactJS有关.即点击链接转到新路线显示localhost:3000/#/localhost:3000/#/about.视路线而定.

reactjs react-router

100
推荐指数
5
解决办法
7万
查看次数

React-router v4 - 无法获取*url*

我开始使用react-router v4.<Router>我的app.js中有一个简单的导航链接(参见下面的代码).如果我导航到localhost/vocabulary,路由器会将我重定向到正确的页面.但是,当我按下重新加载(F5)之后(localhost/vocabulary)时,所有内容都会消失并且浏览器报告Cannot GET /vocabulary.怎么可能?有人能给我任何线索如何解决(正确重新加载页面)?

App.js:

import React from 'react'
import ReactDOM from 'react-dom'
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
import { Switch, Redirect } from 'react-router'
import Login from './pages/Login'
import Vocabulary from './pages/Vocabulary'

const appContainer = document.getElementById('app')

ReactDOM.render(
  <Router>
    <div>
        <ul>
          <li><Link to="/">Home</Link></li>
          <li><Link to="/vocabulary">Vocabulary</Link></li>
        </ul>
        <Switch>
          <Route exact path="/" component={Login} />
          <Route exact path="/vocabulary" component={Vocabulary} />
        </Switch>
    </div>
  </Router>,
appContainer)
Run Code Online (Sandbox Code Playgroud)

javascript routes localhost reactjs react-router

53
推荐指数
5
解决办法
3万
查看次数

Firebase CLI:"配置为单页应用程序(将所有URL重写为/index.html)"

我刚刚使用Firebase CLI来初始化静态托管项目.启用"配置为单页应用程序"选项时会发生什么?我正在寻找一个关于哪些文件被修改的描述,以及它对Firebase后端的影响.

firebase init命令的屏幕截图

firebase firebase-hosting firebase-tools

35
推荐指数
4
解决办法
2万
查看次数

React-router"无法GET/*",但根网址除外

我愿意为我的应用程序使用React-router,我正在尝试首先在doc中给出的示例,我在下面复制了它.现在,当我去localhost:3000/,我看到"App"按预期,但每隔一页,如localhost:3000/inbox返回"无法获取/收件箱".我在这里错过了什么?

var About = React.createClass({
  render: function () {
    return <h2>About</h2>;
}});

var Inbox = React.createClass({
  render: function () {
    return <h2>Inbox</h2>;
}});

var App = React.createClass({
  render () {
    return (
      <div><h1>App</h1>
        <RouteHandler/>
      </div>
)}});

var routes = (
  <Route path='/' handler={App}>
    <Route path="about" handler={About}/>
    <Route path="inbox" handler={Inbox}/>
  </Route>
);
Run Code Online (Sandbox Code Playgroud)

reactjs react-router

26
推荐指数
2
解决办法
3万
查看次数

react routing能够处理不同的url路径,但tomcat返回404不可用的资源

我是新手,reactjs我有一个小项目reactjs可以玩并学习它.我需要输入基于url路径显示的标题类型.所以以下是我的index.js处理路由:

 const history = useRouterHistory(createHistory)({
     basename: '/test'
})
class Tj extends React.Component {

render() {

    return (
        <Router history={history}>
            <Route path={"/"} component={Bridge} >
                <IndexRoute component={Home} />
                <Route path={"user"} component={T} />
                <Route path={"home"} component={Home} />
            </Route>
            <Route path={"/t/"} component={Bridge2} >
                <IndexRoute component={T} />
                <Route path={"contact"} component={Home} />
            </Route>
        </Router>
    );
}
}
render(
<Provider store={store}>
    <Tj/>
</Provider>,
window.document.getElementById('mainContainer'));
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我使用test作为根目录,并根据用户的url输入决定我应该使用哪个头.这里还有Bridge2.js:

export class Bridge2 extends React.Component {
render() {

    return (
        <div>
            <div className="row">
                <Header2/> …
Run Code Online (Sandbox Code Playgroud)

reactjs react-router

22
推荐指数
4
解决办法
2万
查看次数

使用Redux-Router + React-Router为应用程序添加基本URL

我正在使用React-Router 1.0.0-rc3和Redux-Router 1.0.0-beta3.

使用React-Router时,您可以使用useBasenamewith createHistory来设置应用程序的基本URL,以便您可以轻松编写在子目录中运行的应用程序.示例:

而不是这个:

import { createHistory } from 'history';

let base = "/app_name/"

<Router history={browserHistory}>
  <Route path={base} component={App}></Route>
</Router>

<Link path={base + "some_path"}>some_path</Link>
Run Code Online (Sandbox Code Playgroud)

您可以使用以下方式编写useBasename:

import { createHistory, useBasename } from 'history';

const browserHistory = useBasename(createHistory)({
  basename: "/app_name"
});

<Router history={browserHistory}>
  <Route path="/" component={App}></Route>
</Router>

<Link path="/some_path">some_path</Link>
Run Code Online (Sandbox Code Playgroud)

但是,在Redux-Router中,您需要传递createHistory而不是history减速器:

const store = compose(
  applyMiddleware(m1, m2, m3),
  reduxReactRouter({
    routes,
    createHistory
  }),
  devTools()
)(createStore)(reducer);
Run Code Online (Sandbox Code Playgroud)

useBasename在这种情况下我们如何使用?

javascript reactjs react-router redux

15
推荐指数
2
解决办法
2万
查看次数

GitHub页面 - Url重写支持

我已按照此处列出的步骤(https://pages.github.com/)为我正在处理的网站设置了GitHub页面

我设置的站点当前托管在IIS下,并使用URL Rewrite模块.

是否有一个等效的模块或类似的东西,我可以用来重写我的应用程序中的某些URL请求?

github github-pages

8
推荐指数
2
解决办法
2642
查看次数

Vare路由器托管在apache2上

我在apache服务器上托管我的vuejs项目.

  1. init项目
  2. 设置路由器
  3. 构建并托管到apache服务器

const router = new VueRouter({
  routes: Routes,
  // relative: true,
  mode: 'history'
});
Run Code Online (Sandbox Code Playgroud)

这在本地运行良好,但vue路由器在服务器上中断.例

如果我运行http://example.com并转到http://exmaple.com/sub 它工作正常

但如果我刷新页面它会抛出404错误.

错误: 在此输入图像描述

apache vue.js vue-router vuejs2

8
推荐指数
3
解决办法
1万
查看次数

点击刷新时,IIS 上出现路由 404 错误

我没有找到这个问题的解决方案,但我已经尝试了各种解决方案,但没有任何效果。我有一个 React JS 应用程序,当部署在测试服务器上并且您在页面上点击刷新时,我收到 404 错误消息。我尝试过 URL 重写,这有助于导航回主页,但这并不能解决刷新问题。请帮忙。

reactjs

8
推荐指数
3
解决办法
2万
查看次数