Support the ongoing development of Laravel.io →
posted 9 years ago
Installation
Last updated 1 year ago.
0

You need to add a ServerName to your virtualhost definition

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel/public
ServerName learn.dev

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Last updated 1 year ago.
0

You can use

tuyenlaptrinh said:

You can use .htaccess same

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

Or you can use another solution follow step by step

  • Step:1: move all files from public directory to [path_root]/laravel/
  • Step 2: now, no need of public directory, so optionally you can remove it now
  • Step 3: now open index.php and make following replacements
require DIR.'/../bootstrap/autoload.php';

to

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

and

$app = require_once DIR.'/../bootstrap/start.php';

to

$app = require_once DIR.'/bootstrap/start.php';
  • Step 4: now open bootstrap/paths.php and change public directory path:
'public' => DIR.'/../public',

to

'public' => DIR.'/..',

And in apache

<VirtualHost>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel/

ServerName learn.dev
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

You will successful when run learn.dev

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

MIH1406 mih1406 Joined 6 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.