support redirects
This commit is contained in:
parent
0303019641
commit
092efca34d
15
rebuild.php
15
rebuild.php
@ -452,6 +452,18 @@ function buildcommon() {
|
||||
// Done
|
||||
}
|
||||
|
||||
function buildredirects($redirects) {
|
||||
foreach($redirects as $oldname => $newname) {
|
||||
ob_start();
|
||||
?>
|
||||
<meta http-equiv="refresh" content="0; url=<?=hesc($newname)?>.html">
|
||||
<a href="<?=hesc($newname)?>.html">Moved »</a>
|
||||
<?php
|
||||
$page = ob_get_clean();
|
||||
file_put_contents(BASEDIR.'wwwroot/'.$oldname.'.html', $page);
|
||||
}
|
||||
}
|
||||
|
||||
function main($args) {
|
||||
$basedir = './';
|
||||
$total = $args[0];
|
||||
@ -480,6 +492,9 @@ function main($args) {
|
||||
|
||||
if ($pos == 0) {
|
||||
buildcommon();
|
||||
if (array_key_exists('redirect', $config)) {
|
||||
buildredirects( $config['redirect'] );
|
||||
}
|
||||
} else {
|
||||
buildprojects($pos, array_decimate(listprojects(), $total, $pos));
|
||||
}
|
||||
|
@ -6,3 +6,7 @@ index_thumb_w=90
|
||||
index_thumb_h=32
|
||||
|
||||
; n.b. Recommend a multiple of the JPEG iDCT block size for index_thumb_h
|
||||
|
||||
[redirect]
|
||||
; old project name = new project name
|
||||
code.ivysaur.me=codesite
|
||||
|
@ -6,3 +6,8 @@ index_thumb_w=90
|
||||
index_thumb_h=32
|
||||
|
||||
; n.b. Recommend a multiple of the JPEG iDCT block size for index_thumb_h
|
||||
|
||||
[redirect]
|
||||
; old project name = new project name
|
||||
old-project-name=example-project
|
||||
|
||||
|
Reference in New Issue
Block a user