Change working directory

You need to change your working directory to public folder

There are two ways you can do this:

  1. Using .htaccess file

  2. By changing document root directory (Recommended)

Using .htaccess

Create a .htaccess file on the root directory( where .env is located)

Ignore if already available

Edit .htaccess file and paste the below content

<IfModule mod_rewrite.c>
   RewriteEngine On 
   RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

By changing document root directory

1. Login to Cpanel. 2. In the Domains section, click the Addon Domains or Subdomains icon, depending on which you'd like to modify.

3. Locate the addon domain (or subdomain) you wish to modify.

4. Click the pencil icon next to the current document root for the domain you wish to modify.

5. In the pop-up window, enter the new document root(from example.com to example.com/public) and click Change

Last updated