Remove "public" from URL

If you are unable to change the document root to domain.com/public during the setup of your domain, to install the application, because your domain is the primary domain of the host and is automatically assigned to the public_html directory, then create a file called .htaccess with the following content in this directory, in order to remove the public path from the application URL.

<IfModule mod_rewrite.c>
    RewriteEngine On

    ## You may need to uncomment (remove #) the following line.
    ## If you have installed to a subdirectory, enter the name.
    ## Example: for https://site.com enter: "/"
    ## For https://site.com/abc enter: "/abc/"
    ##
    ## RewriteBase /

    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]

    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>