Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tjkalinowski's avatar

Change public folder

How to change Laravel public folder to any other name. For example "public_html" ? How to relocate the public folder to different path?

0 likes
5 replies
goatshark's avatar

@TJKALINOWSKI That's a web server "thing". In a typical nginx setup, you'll be looking for /etc/nginx/sites-available/<somesiteconfigfile>. Inside of the server {} section of the config file is a declaration for root.

server {
    listen 80;
    listen 443 ssl;
    server_name mysite.dev;
    root "/path/to/mysite/public";
    ...

So if you're going to use something other than "public", you can change it in the config file accordingly. Don't forget to service nginx restart when you're done making changes. (or however your distribution handles services)

If you're using Apache, the setup is similar, but I believe the config files are located somewhere under /etc/apache2 or perhaps /etc/httpd depending on your distro.

If you're using something other than Nginx or Apache... I have no idea. The concept should be the same though, tell the web server to serve up files from a different location.

jlrdw's avatar

All is done by properly resolving your paths correctly.

tjkalinowski's avatar

Thank you all for replay, but my question was not precise. I was asking about change the patch in Laravel itself files (source code or config).

I am not talking about changing server HTTP apache or Nginx settings itself. Try to imagine that i have virtual hosting service with hardcoded path name, and my goal is to adjust laravel to feet into servers path.

For example, my path is /home/user1/public_html and i want to upload my laravel app to /home/user1 and the rename laravel's public folder to public_html and change laravel config to SEE it. As you know, In default setting it always SEE /public.

Keeping that in mind, can you tell me again?

I have found in config/filesystems.php file that. It that setting?


'root' => storage_path('app/public')

Snapey's avatar

@jim1506 far easier to delete (eg) public_html and create a symlink pointing public_html to public

Please or to participate in this conversation.