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
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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community