how to access website from a sub folder inside the root folder?

I am guessing it is an apache server. If yes;

  1. Ensure your domain mywebsitename.com points to the public_html
  2. Add a .htaccess file in your root directory(public_html) and paste this in
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteRule ^(.*)$ public/$1 [L]
    </IfModule>

I found a solution to this question.

1.Copy all the laravel files inside the public_html folder including the .htaccess file and the index.php file which is suppose to be inside the public folder(keep both the files inside the public folder).

2.Then link your storage to the public folder using SSH, for that open your SSH enter id and password and change directory using "cd domains/yourdomainname.com/public_html" then give the php artisan command i.e "php artisan storage:link" (note:- after changing the directory you can give all the php artisan commands like migrate and config:cache or clear:cache as you wish.

3.Now after the all the necessary commands are given you can access your fully functional website including the image display function if you type yourdomainname.com/public on the URL but if you type just your domain name then all the laravel files will appear on the browser to avoid this and to to jump inside the public folder directly create one more .htaccess file outside the public folder but inside the
public_html folder the copy the below given code and then if you just your domain name on the URL then your website will be directly displayed

Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^ public [L]

You can use it with RewriteBase directive,

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    RewriteBase /public_html/ # or '/' only depends on your vhost config

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

</IfModule>