Wrap rewrite rules in IfModule. Bug 318.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-09-28 17:55:52 +00:00
parent 71ee7bb747
commit f16701674d
1 changed files with 23 additions and 21 deletions

View File

@ -1428,7 +1428,8 @@ function mod_rewrite_rules ($permalink_structure) {
$home_root = preg_replace('|([^/]*)(.*)|i', '$2', $home_root); $home_root = preg_replace('|([^/]*)(.*)|i', '$2', $home_root);
if ('/' != substr($home_root, -1)) $home_root = $home_root . '/'; if ('/' != substr($home_root, -1)) $home_root = $home_root . '/';
$rules = "RewriteEngine On\n"; $rules = "<IfModule mod_rewrite.c>\n";
$rules .= "RewriteEngine On\n";
$rules .= "RewriteBase $home_root\n"; $rules .= "RewriteBase $home_root\n";
$rewrite = rewrite_rules('', $permalink_structure); $rewrite = rewrite_rules('', $permalink_structure);
foreach ($rewrite as $match => $query) { foreach ($rewrite as $match => $query) {
@ -1441,6 +1442,7 @@ function mod_rewrite_rules ($permalink_structure) {
$rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA]\n"; $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA]\n";
} }
} }
$rules .= "</IfModule>\n";
$rules = apply_filters('rewrite_rules', $rules); $rules = apply_filters('rewrite_rules', $rules);