我试图将所有页面重定向到一页。我从堆栈溢出中的以下question获得了解决方案,但出现Too many redirects
错误。这是我的代码:
Options -MultiViews +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/closing-down$
RewriteCond %{REMOTE_HOST} !^my\.ip\.11\.11
RewriteRule $ /closing-down [R=302,L]
答案 0 :(得分:0)
将规则更改为此:
generic
并在新的浏览器中对此进行测试,以避免旧的缓存。
在WP默认规则之后,使用ls node_modules
代替import PropTypes from "prop-types";
import hoistNonReactStatics from "hoist-non-react-statics";
import getInjectors from "./reducerInjectors";
export default ({key, reducer}) => WrappedComponent => {
class ReducerInjector extends Component {
static WrappedComponent = WrappedComponent;
static displayName = `withReducer(${WrappedComponent.displayName ||
WrappedComponent.name ||
"Component"})`;
static contextTypes = {
store: PropTypes.object.isRequired,
};
//THIS LINE
injectors = getInjectors(this.context.store);
UNSAFE_componentWillMount() {
const {injectReducer} = this.injectors;
injectReducer(key, reducer);
}
render() {
return <WrappedComponent {...this.props} />;
}
}
return hoistNonReactStatics(ReducerInjector, WrappedComponent);
};
作为Options -MultiViews +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{THE_REQUEST} !\s/closing-down[\s?] [NC]
RewriteCond %{REMOTE_HOST} !^my\.ip\.11\.11
RewriteRule ^ /closing-down [R=302,L]
可能会更改为THE_REQUEST
,而对于Web请求,REQUEST_URI
保持不变。