修复 rewrite规则中archiver/的错误

This commit is contained in:
康盛Discuz! 2017-01-01 20:50:06 +08:00
parent 3d06e0ae75
commit aca3699abb
1 changed files with 7 additions and 10 deletions

View File

@ -462,16 +462,13 @@ if($operation == 'filecheck') {
$vkeys = array_keys($rewritedata['rulevars'][$k]);
$rewritedata['rulereplace'][$k] = pvsort($vkeys, $v, $rewritedata['rulereplace'][$k]);
$v = str_replace($vkeys, $rewritedata['rulevars'][$k], addcslashes($v, '?*+^$.[]()|'));
$rule['{apache1}'] .= "\t".'RewriteCond %{QUERY_STRING} ^(.*)$'."\n\t".'RewriteRule ^(.*)/'.$v.'$ $1/'.pvadd($rewritedata['rulereplace'][$k])."&%1\n";
if($k != 'forum_archiver') {
$rule['{apache2}'] .= 'RewriteCond %{QUERY_STRING} ^(.*)$'."\n".'RewriteRule ^'.$v.'$ '.$rewritedata['rulereplace'][$k]."&%1\n";
} else {
$rule['{apache2}'] .= 'RewriteCond %{QUERY_STRING} ^(.*)$'."\n".'RewriteRule ^archiver/'.$v.'$ archiver/'.$rewritedata['rulereplace'][$k]."&%1\n";
}
$rule['{iis}'] .= 'RewriteRule ^(.*)/'.$v.'(\?(.*))*$ $1/'.addcslashes(pvadd($rewritedata['rulereplace'][$k]).'&$'.($pvmaxv + 1), '.?')."\n";
$rule['{iis7}'] .= "\t\t".'<rule name="'.$k.'">'."\n\t\t\t".'<match url="^(.*/)*'.str_replace('\.', '.', $v).'\?*(.*)$" />'."\n\t\t\t".'<action type="Rewrite" url="{R:1}/'.str_replace(array('&', 'page\%3D'), array('&', 'page%3D'), addcslashes(pvadd($rewritedata['rulereplace'][$k], 1).'&{R:'.$pvmaxv.'}', '?')).'" />'."\n\t\t".'</rule>'."\n";
$rule['{zeus}'] .= 'match URL into $ with ^(.*)/'.$v.'\?*(.*)$'."\n".'if matched then'."\n\t".'set URL = $1/'.pvadd($rewritedata['rulereplace'][$k]).'&$'.$pvmaxv."\nendif\n";
$rule['{nginx}'] .= 'rewrite ^([^\.]*)/'.$v.'$ $1/'.stripslashes(pvadd($rewritedata['rulereplace'][$k]))." last;\n";
$rulepath = $k != 'forum_archiver' ? '' : 'archiver/';
$rule['{apache1}'] .= "\t".'RewriteCond %{QUERY_STRING} ^(.*)$'."\n\t".'RewriteRule ^(.*)/'.$v.'$ $1/'.$rulepath.pvadd($rewritedata['rulereplace'][$k])."&%1\n";
$rule['{apache2}'] .= 'RewriteCond %{QUERY_STRING} ^(.*)$'."\n".'RewriteRule ^'.$v.'$ '.$rulepath.$rewritedata['rulereplace'][$k]."&%1\n";
$rule['{iis}'] .= 'RewriteRule ^(.*)/'.$v.'(\?(.*))*$ $1/'.$rulepath.addcslashes(pvadd($rewritedata['rulereplace'][$k]).'&$'.($pvmaxv + 1), '.?')."\n";
$rule['{iis7}'] .= "\t\t".'<rule name="'.$k.'">'."\n\t\t\t".'<match url="^(.*/)*'.str_replace('\.', '.', $v).'\?*(.*)$" />'."\n\t\t\t".'<action type="Rewrite" url="{R:1}/'.str_replace(array('&', 'page\%3D'), array('&', 'page%3D'), $rulepath.addcslashes(pvadd($rewritedata['rulereplace'][$k], 1).'&{R:'.$pvmaxv.'}', '?')).'" />'."\n\t\t".'</rule>'."\n";
$rule['{zeus}'] .= 'match URL into $ with ^(.*)/'.$v.'\?*(.*)$'."\n".'if matched then'."\n\t".'set URL = $1/'.$rulepath.pvadd($rewritedata['rulereplace'][$k]).'&$'.$pvmaxv."\nendif\n";
$rule['{nginx}'] .= 'rewrite ^([^\.]*)/'.$v.'$ $1/'.$rulepath.stripslashes(pvadd($rewritedata['rulereplace'][$k]))." last;\n";
}
$rule['{nginx}'] .= "if (!-e \$request_filename) {\n\treturn 404;\n}";
echo str_replace(array_keys($rule), $rule, cplang('rewrite_message'));