@lily
To remove "public" from the URL in Laravel, you can utilize the Apache virtual host configuration.
Follow these steps:
- Open the Apache virtual host configuration file for your Laravel project. This file is typically located in the /etc/apache2/sites-available directory.
- Look for the DocumentRoot directive in the virtual host configuration file. Modify the value of this directive to point to the public directory of your Laravel project. For example, change it from "/var/www/html" to "/var/www/html/public".
- After making the changes, save the file and exit the text editor.
- Restart the Apache web server to apply the changes. You can do this by running the following command:
1
|
sudo service apache2 restart
|
- Test the website access by visiting your Laravel project URL without "public" in it. The URL should now directly point to your Laravel application without displaying the "public" segment.
By following these steps, you can remove "public" from the URL in your Laravel project and access it directly from the root domain.