Translate some urls in redirect from Gitea to GitHub
This commit is contained in:
parent
2ac6af6b5c
commit
a26b936989
@ -16,7 +16,9 @@ git.bbaovanc.com {
|
|||||||
@404 status 404
|
@404 status 404
|
||||||
handle_response @404 {
|
handle_response @404 {
|
||||||
handle /bbaovanc/* {
|
handle /bbaovanc/* {
|
||||||
redir https://github.com{uri} permanent
|
root * /etc/caddy/github-redirect/
|
||||||
|
rewrite * /index.php?uri={uri}
|
||||||
|
php_fastcgi unix//run/php/php-fpm.sock
|
||||||
}
|
}
|
||||||
|
|
||||||
handle {
|
handle {
|
||||||
|
7
github-redirect/index.php
Normal file
7
github-redirect/index.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
$uri = $_GET["uri"];
|
||||||
|
$uri = preg_replace('/(\/bbaovanc\/.*?(?=\/))\/src\/(commit|branch)/', '$1/blob', $uri);
|
||||||
|
$uri = preg_replace('/(\/bbaovanc\/.*?(?=\/))\/(commits|blame)\/(branch|commit)/', '$1/$2', $uri);
|
||||||
|
header('Status: 301 Moved Permanently');
|
||||||
|
header('Location: https://github.com' . $uri);
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user