support redirects
This commit is contained in:
parent
0303019641
commit
092efca34d
15
rebuild.php
15
rebuild.php
@ -452,6 +452,18 @@ function buildcommon() {
|
|||||||
// Done
|
// 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) {
|
function main($args) {
|
||||||
$basedir = './';
|
$basedir = './';
|
||||||
$total = $args[0];
|
$total = $args[0];
|
||||||
@ -480,6 +492,9 @@ function main($args) {
|
|||||||
|
|
||||||
if ($pos == 0) {
|
if ($pos == 0) {
|
||||||
buildcommon();
|
buildcommon();
|
||||||
|
if (array_key_exists('redirect', $config)) {
|
||||||
|
buildredirects( $config['redirect'] );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buildprojects($pos, array_decimate(listprojects(), $total, $pos));
|
buildprojects($pos, array_decimate(listprojects(), $total, $pos));
|
||||||
}
|
}
|
||||||
|
@ -6,3 +6,7 @@ index_thumb_w=90
|
|||||||
index_thumb_h=32
|
index_thumb_h=32
|
||||||
|
|
||||||
; n.b. Recommend a multiple of the JPEG iDCT block size for index_thumb_h
|
; 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
|
index_thumb_h=32
|
||||||
|
|
||||||
; n.b. Recommend a multiple of the JPEG iDCT block size for index_thumb_h
|
; 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