37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
// Only run this if running from php 5.4 embedded server
|
|
if (php_sapi_name() == 'cli-server') {
|
|
|
|
if ( preg_match( '/\.(?:js|ico|gif|jpg|png|css|asc|txt|eot|woff|ttf|ttf|svg)$/', $_SERVER["REQUEST_URI"] ) ) {
|
|
|
|
// serves fronted
|
|
if ( preg_match( '/^\/public/', $_SERVER["REQUEST_URI"] ) ) {
|
|
return false;
|
|
}
|
|
|
|
// serves favicons
|
|
if ( preg_match( '/^\/data/', $_SERVER["REQUEST_URI"] ) ) {
|
|
return false;
|
|
}
|
|
|
|
//redirects to proper location for favicons
|
|
if ( preg_match( '/(favicons|thumbnails)/', $_SERVER["REQUEST_URI"] ) ) {
|
|
header( "Location: /data".$_SERVER["REQUEST_URI"] );
|
|
exit;
|
|
}
|
|
|
|
//redirects to proper location for frontend
|
|
header( "Location: /public".$_SERVER["REQUEST_URI"] );
|
|
exit;
|
|
|
|
} else {
|
|
// taken from cli arg, hack for updater
|
|
$_SERVER["SERVER_ADDR"] = '127.0.0.1';
|
|
$_SERVER["SERVER_NAME"] = '127.0.0.1';
|
|
$_SERVER["SERVER_PORT"] = '80';
|
|
require("index.php");
|
|
}
|
|
|
|
}
|