CodeIgniter Forums
Code Igniter static files with PHP 5.4 built in web server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Code Igniter static files with PHP 5.4 built in web server (/showthread.php?tid=59325)



Code Igniter static files with PHP 5.4 built in web server - El Forum - 09-21-2013

[eluser]Unknown[/eluser]
Hello everyone. I've been trying to make my static files in CodeIgniter to show up when launching the site from PHP 5.4's built in web server.

I am aware that I need to route static files in case php is running from CLI via
Code:
$filename = __DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
if (php_sapi_name() === 'cli-server' && is_file($filename)) {
    return false;
}
but not sure exactly where to place this piece of code.

Tried to include it in index.php and application/config/routes.php but that didn't work.

Thanks for the help.