当Laravel安装在子目录中时,如何从Laravel URL(v5.6)中删除“public”

I'm using WordPress for my business site and Laravel for Project management application.

Here is my directory structure.

public_html
    -mainsite (my WordPress site is in this directory)
    -work (Laravel Application is in this directory)

When user visits my primary domain (e.g. www.example.com) I'm redirecting the visitor to www.example.com/mainsite using following .htaccess rules

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/mainsite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /mainsite/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ mainsite/index.php [L] 
</IfModule>

My project management application which is located in 'work' directory is easily accessible with this URL

www.example.com/work/public

Now I want to allow users to access my project management application with this URL (I want to remove 'public' from URL)-

www.example.com/work

Could you please help me to resolve this issue?

(It is easy to remove 'public' from URL when Laravel is installed in the root directory and I know how to do that)

This is not a duplicate question and here is the reason- My Laravel installation is in subdirectory of my root directory and I'm also using different site (a WordPress site) for my base URL

i guess this is what you want..

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

    RewriteEngine On

    # 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>

Add these rules:

RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
RewriteCond %{REQUEST_URI} !^/work/public/
RewriteRule ^work/(.*)$  /work/public/$1 [L] 

So all rules together should look like this :

 <IfModule mod_rewrite.c>
 RewriteEngine on

 RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
 RewriteCond %{REQUEST_URI} !^/work/public/
 RewriteRule ^work/(.*)$  /work/public/$1 [L]

 RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
 RewriteCond %{REQUEST_URI} !^/mainsite/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ /mainsite/$1  [L]
 RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
 RewriteRule ^(/)?$ mainsite/index.php [L] 
 </IfModule>

Note: clear browser cache the test