Aggiunto redirect in caso di public raggiungibile

This commit is contained in:
Dasc3er 2021-08-06 13:04:53 +02:00
parent d9ac17d1b2
commit c50a381626
3 changed files with 29 additions and 1 deletions

4
.htaccess Normal file
View File

@ -0,0 +1,4 @@
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^.+$ index.php [L]
</IfModule>

24
index.php Normal file
View File

@ -0,0 +1,24 @@
<?php
$base_dir = __DIR__;
// Individuazione di $prefix
$script = $_SERVER['REQUEST_URI'];
$needle = '/'.basename($base_dir).'/';
$pos = strrpos($script, $needle);
if ($pos !== false) {
$prefix = substr($script, 0, $pos).$needle;
$suffix = substr($script, $pos + strlen($needle));
} else {
$prefix = '/';
$suffix = '';
}
$prefix = rtrim($prefix, '/');
$prefix = str_replace('%2F', '/', rawurlencode($prefix));
$suffix = str_replace('%2F', '/', rawurlencode($suffix));
$url = 'http://'.$_SERVER['HTTP_HOST'].$prefix.'/public/'.$suffix;
$url = str_replace('index.php', '', $url);
header('Location: '.$url);
exit();

2
legacy

@ -1 +1 @@
Subproject commit 39a79aea88f220f4d49c349df176b1ef310005f8
Subproject commit af0668f0c2e9751c36430e1b7595a1d32058ef64