blob: 354af7ff4e66861f9a21ac33bc6439dc93ded53b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<?php
/**
* Convert the .htaccess rewrite rules into an array of pattern-replacement
* pairs.
* Writes src/gen-rewritemap.php
*/
$lines = file(__DIR__ . '/../www/.htaccess');
$patterns = array();
foreach ($lines as $line) {
if (substr($line, 0, 11) == 'RewriteRule') {
list($n, $pattern, $replace) = explode(' ', rtrim($line));
$patterns['#' . $pattern . '#'] = $replace;
}
}
file_put_contents(
__DIR__ . '/../src/gen-rewritemap.php',
"<?php\n/* automatically created from www/.htaccess */\nreturn "
. var_export($patterns, true)
. ";\n?>\n"
);
?>
|