DEV Community

Adam Mateusz Brożyński
Adam Mateusz Brożyński

Posted on

Laravel public to public_html

Rename public dir:

$ mv ./public ./public_html

In app\Providers\AppServiceProvider.php:

public function register() {
  $this->app->bind('path.public', function() {
    return base_path().'/public_html';
   });
}

in server.php:

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public_html'.$uri)) {
    return false;
}
require_once __DIR__.'/public_html/index.php';

Top comments (0)