Nikunj Kumar
Nikunj Kumar

Reputation: 306

How to deploy laravel Application so that url doesn't contain '/public/index'

I have a laravel application which contain an index file in its public folder which I can access using the following url:

myIpAddress/teamsync/public/index

But I want to use url like this:

myIpAddress/teamsync to access my index file.

Upvotes: 0

Views: 114

Answers (1)

sigint
sigint

Reputation: 34

Perhaps the best way to remove /public/... is to set up your virtual host configuration file to set up the /public directory as the document root. This kills two birds with one stone by allowing you to set yoursitename.com as Laravel's root, but also moving sensitive back-end files up away from the www root folder.

<VirtualHost *:80>
    ServerName myserver
    DocumentRoot /var/www/yourproject/public
    ServerAlias www.example.com
</VirtualHost>

Examples on how to use virtual hosts:

Upvotes: 1

Related Questions