mirror of
https://github.com/thewesker/greptweet.git
synced 2025-12-20 04:01:06 -05:00
Redirect to fetch if there is an issue
This commit is contained in:
@@ -19,13 +19,14 @@ http {
|
|||||||
charset utf-8;
|
charset utf-8;
|
||||||
access_log /srv/http/u/greptweet.access.log;
|
access_log /srv/http/u/greptweet.access.log;
|
||||||
error_log /srv/http/u/greptweet.error.log;
|
error_log /srv/http/u/greptweet.error.log;
|
||||||
|
error_page 404 403 =303 /404.php;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
index index.php index.html;
|
index index.php index.html;
|
||||||
rewrite ^/f/(.*)$ /create.php?id=$1 last;
|
rewrite ^/f/(.*)$ /create.php?id=$1 last;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ \.(svg|txt)$ {
|
location ~ \.(txt)$ {
|
||||||
add_header Content-Encoding gzip;
|
add_header Content-Encoding gzip;
|
||||||
gzip off;
|
gzip off;
|
||||||
}
|
}
|
||||||
|
|||||||
11
www/404.php
Normal file
11
www/404.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
if (preg_match('#^/u/#', $_SERVER["REQUEST_URI"])) {
|
||||||
|
$username = basename($_SERVER["REQUEST_URI"]);
|
||||||
|
if ((!empty($username)) && (strlen($username < 16)) && preg_match('/^[A-Za-z0-9_]+$/', $username)) {
|
||||||
|
header("Location:http://" . $_SERVER["HTTP_HOST"] . "/f/" . $username);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<img style="width: 20%;" src=/icons/greptweet_birdie.svg>
|
||||||
|
<h1>Error <?php echo $_SERVER["REQUEST_URI"]; ?></h1>
|
||||||
Reference in New Issue
Block a user