Use Laravel in subfolder
Tác giả: Dương Nguyễn Phú Cường
Ngày đăng: 21 giờ trước
Lượt xem: 17
https://medium.com/@lucabecchetti/configure-laravel-to-work-in-a-subdirectory-and-with-artisan-serve-at-the-same-time-654ba0c1fd0b
Running Laravel 5 in a Subdirectory
Step 1: Apache Config
Make sure to alias your subdirectory to the public directory of your Laravel project. Let's say my site is going to be at http://mydomain.com/laravel-site. My Apache config would look like this:Alias /laravel-site /path/to/laravel/public
<Directory /path/to/laravel/public>
AllowOverride All
Require all granted
</Directory>
Step 2: Laravel .htaccess
file
This was that part I got stuck on. The /
route was fine but all other routes threw an Internal Server Error (which turned out to be a redirect loop).
To fix this, add the following to your public/.htaccess
file:
RewriteBase /laravel-site