Support the ongoing development of Laravel.io →
Configuration
Last updated 2 years ago.
0
Solution

Please calm down. Rage has never helped anybody.

Since you write about the public_html folder I assume you have access to the folder that contains the public_html folder? If so:

  1. Put all your Laravel stuff in the top-level folder (so that the app folder is next to the public_html folder)
  2. Move all files from public to public_html (be sure to also move hidden files, such as .htaccess!)
  3. Delete the now empty public folder
  4. In bootstrap/path.php change
  • 'public' => DIR.'/../public', to

    'public' => DIR.'/../public_html',

Hope this fixes it.. wouldn't want to upset you any further ;)

Note: OP completely changed his post after the solution was posted...

Last updated 9 years ago.
0

Please mark thread as SOLVED if this solved it for you ;)

0

I am going to write a detailed explanation in the wish that it spares the rest of mankind the issues and frustration that I had with it:

SCENARIO:

You are using Cpanel and are on a shared hosting. You have your main domain and then you also add "add -on" domains:

For your main domain

  1. It is advisable to move all the files and folders EXCEPT the public one, to a folder just above the level of public_html, that is, outside the web root directory, basically for security issues. But this so far has nothing to do with removing the Public from the URL

  2. Then, you can take that index.php that sits inside your original Public folder and move it one level above.

  3. Now, as you probably know, the Request life cycle goes like this:

.htaccess------------> index.php ----------> bootstrap/paths.php and autoload and start files.---------> routes-->objects

  1. As you have moved the index.php outside its original place but also the other files and folders, they still need to keep in touch, so edit the paths inside the index.php file to catch up with the files inside the bootstrap folder.

SCENARIO 2.

Now you are going to add an add-on domain.. There is a direct way to do this:

Let softaculous install you the Laravel stuff and then, (only then) go to your cpanel, go to the section where the Add on domains are, and then EDIT the document root adding a /public at the end.

That is: DO NOT CREATE THE ADDON ADDING THAT PUBLIC at the end and then proceed to install Laravel. It will not work. You have to modify it ONCE you have already installed Laravel.

Last updated 9 years ago.
0

But note the following:

what you describe would apply when you only have one Main domain.I already had that one domain without the Public issue. The problem is when you add other domains (addon domains). You cannot throw all of the files and folders just above the public_html because they would crash and conflict and overwrite each other. That is the problem I would have. So, by doing as I write, there are no conflicts.

0

Ok, I see. You are working with SUB-domains ;)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.