我的规则导致500内部错误 试图
var ConnectRoles = require('connect-roles');
var user = new ConnectRoles();
user.use('admin', function(req) {
return req.user && req.user.role === 'admin';
})
app.get('/admin', user.is('admin'), function(req, res, next) {
res.end();
})
此
RewriteRule ^\/toolkit\/families\-of\-schools\/start\/(.*)$ /toolkit/families-of-schools/start/?school=$1
我做错了什么?
答案 0 :(得分:0)
它导致500内部服务器错误,因为您的模式也匹配重写的URL并导致无限循环。
试试这个:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,NE,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{ENV:REDIRECT_STATUS} !^$
RewriteRule ^ - [L]
RewriteRule ^.*?(families-of-schools/start)/(.+)$ index.php/$1?school=$2 [L,QSA]
RewriteRule ^(.+)$ index.php/$1 [QSA,L]