| 1222 | | $this->matches = ''; |
|---|
| 1223 | | $rewrite = $this->rewrite_rules(); |
|---|
| 1224 | | $num_rules = count($rewrite); |
|---|
| 1225 | | $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" . |
|---|
| 1226 | | "RewriteCond %{REQUEST_FILENAME} -d\n" . |
|---|
| 1227 | | "RewriteRule ^.*$ - [S=$num_rules]\n"; |
|---|
| 1228 | | |
|---|
| 1229 | | foreach ($rewrite as $match => $query) { |
|---|
| 1230 | | // Apache 1.3 does not support the reluctant (non-greedy) modifier. |
|---|
| 1231 | | $match = str_replace('.+?', '.+', $match); |
|---|
| 1232 | | |
|---|
| 1233 | | // If the match is unanchored and greedy, prepend rewrite conditions |
|---|
| 1234 | | // to avoid infinite redirects and eclipsing of real files. |
|---|
| 1235 | | if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) { |
|---|
| 1236 | | //nada. |
|---|
| 1237 | | } |
|---|
| 1238 | | |
|---|
| 1239 | | if (strstr($query, $this->index)) { |
|---|
| 1240 | | $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; |
|---|
| 1241 | | } else { |
|---|
| 1242 | | $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n"; |
|---|
| 1243 | | } |
|---|
| 1244 | | } |
|---|
| | 1224 | |
|---|
| | 1225 | if ($this->use_verbose_rules) { |
|---|
| | 1226 | $this->matches = ''; |
|---|
| | 1227 | $rewrite = $this->rewrite_rules(); |
|---|
| | 1228 | $num_rules = count($rewrite); |
|---|
| | 1229 | $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" . |
|---|
| | 1230 | "RewriteCond %{REQUEST_FILENAME} -d\n" . |
|---|
| | 1231 | "RewriteRule ^.*$ - [S=$num_rules]\n"; |
|---|
| | 1232 | |
|---|
| | 1233 | foreach ($rewrite as $match => $query) { |
|---|
| | 1234 | // Apache 1.3 does not support the reluctant (non-greedy) modifier. |
|---|
| | 1235 | $match = str_replace('.+?', '.+', $match); |
|---|
| | 1236 | |
|---|
| | 1237 | // If the match is unanchored and greedy, prepend rewrite conditions |
|---|
| | 1238 | // to avoid infinite redirects and eclipsing of real files. |
|---|
| | 1239 | if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) { |
|---|
| | 1240 | //nada. |
|---|
| | 1241 | } |
|---|
| | 1242 | |
|---|
| | 1243 | if (strstr($query, $this->index)) { |
|---|
| | 1244 | $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n"; |
|---|
| | 1245 | } else { |
|---|
| | 1246 | $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n"; |
|---|
| | 1247 | } |
|---|
| | 1248 | } |
|---|
| | 1249 | } else { |
|---|
| | 1250 | $rules .= "RewriteCond %{REQUEST_FILENAME} !-f\n" . |
|---|
| | 1251 | "RewriteCond %{REQUEST_FILENAME} !-d\n" . |
|---|
| | 1252 | "RewriteRule . {$home_root}{$this->index}\n"; |
|---|
| | 1253 | } |
|---|
| | 1254 | |
|---|