我正在尝试编写一个仅允许P00:0:R
用于网站的分页系统的重写规则。
我使用php尝试过,效果很好。但是,如何将这样的内容写入重写规则?
$x = 'P10:10:R';
if(pageNos($x)) {
echo 'Passed';
} else {
echo 'Failed';
}
//
function pageNos($page) {
if(preg_match('/^[P]{1}[0-9]{1,10}[:]{1}[0-9]{1,10}[:]{1}[L|R]{1}$/',$page)) {
return true;
} else {
return false;
}
}
我所获得的规则是
RewriteEngine On
RewriteRule ^/?([P]{1}[0-9]{1,10}[:]{1}[0-9]{1,10}[:]{1}[L|R]{1}+)/?$ /test/index.php [NC,L]
禁止的
You don't have permission to access /P10:2:R on this server.
您将得到禁止的错误,因为:
Windows上的Apache不允许在URL中使用。在Windows上,将冒号用作驱动器号分隔符是禁止的。
但是请注意,:
在Linux和其他非Windows平台上,冒号()允许作为有效字符。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句