2

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

Saurabh Borse
  • 163
  • 1
  • 1
  • 12

1 Answers1

0
  • Move Laravel to outside of public_html
  • Move content of Laravel's public folder to public_html/work
  • Put the following code in the \App\Providers\AppServiceProvider register():

    $this->app->bind('path.public', function() { return base_path('public_html/work'); });

Murat Tutumlu
  • 762
  • 6
  • 16