It seems like you've encountered a couple of issues while deploying your Laravel project on shared hosting. Let's address each one separately:
Symlink Error:
When you modified the folder structure of your Laravel project, the default symlink created by the php artisan storage:link command won't work because the storage folder is now located outside the public_html directory.
To solve this issue, you can manually create the symbolic link to the storage folder. Here are the steps to follow:
Connect to your shared hosting account using SSH or the hosting provider's file manager.
Navigate to the public_html folder.
Delete the existing storage folder if it exists.
Create a symlink from the public_html folder to the storage folder using the following command:
ln -s /full/path/to/ProjectName/storage/app/public storage
Replace "/full/path/to/ProjectName" with the actual path to your Laravel project's storage folder.
By creating this symlink, the Laravel application will be able to access the storage files from the public folder.
Redirection to /public and 404 Error:
The issue you're facing with the redirection to /public and the resulting 404 error could be due to incorrect routing configuration.
To fix this, make sure you have made the necessary changes to the index.php file located in the public_html folder. Open the index.php file and modify the following lines:
Change:
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
To:
require __DIR__.'/../ProjectName/vendor/autoload.php';
$app = require_once __DIR__.'/../ProjectName/bootstrap/app.php';
Make sure to replace ProjectName with the actual folder name where your Laravel project resides outside the public_html directory.
After making these changes, save the index.php file and try accessing your website again. It should now correctly route to your Laravel application.
Remember to ensure the necessary permissions are set on the folders and files, as required by Laravel, to avoid any further issues.
If you continue to encounter any problems, please provide more specific details about the error messages or any other relevant information.