0

I am trying to deploy a laravel application to godaddy linux hosting. I am having problems referencing the public/index inside the laravel folder to be used by the domain I bought.

I have seen tutorials moving the files inside the public folder in the hosting root (public). As much as possible, I would like to refrain from moving the public files in the document root since I'll be hosting several web applications there. Is there any way to do this?

The site index is http://filcaspro.com/site/public. I would like to remove the /site/public when accessing the website.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
wendecator
  • 49
  • 2
  • 11

1 Answers1

2

I understand your situation. Do this

Let's consider that the subject project called "website"

originally "website" directory is something like this.

 - app
 - bootstrap
 - config 
 - database
 - public
 - ...
 - vendor
 - .env
 - artisan
 - composer.json

Now this is what you need to do. group everything to a folder name "website" (your subject project all or call it something you want) but Except for the "public folder"

You should have directory to look like this.

- website
    - app
    - bootstrap
    - ...
    - .env
    - composer.json
- public

Now for the public folder, move everything outside and will look like this.

- website
  - app
  - bootstrap
  - ...
  - .env
  - composer.json
- index.php
- .htaccess
- (your assets css/js/images files)

You're almost there, we should just need to edit the index.php from

require __DIR__.'/../bootstrap/autoload.php'; 

to

require __DIR__.'/website/bootstrap/autoload.php';  //where website is the new foldername

and

$app = require_once __DIR__.'/../bootstrap/app.php';

to

$app = require_once __DIR__.'/wesbite/bootstrap/app.php';

This should work now. and no need to access via "/public" folder in order to run the website in goDaddy or any sharedhosting in cpanel.

Kenneth Sunday
  • 865
  • 7
  • 14