I can't find any information whatsoever about performing a Laravel installation in a subfolder.
Is it even possible to do this? Or is it a Laravel requirement to be installed at root level?
My hosting provider doesn't allow me to create VirtualHosts, and I need to install a Laravel application alongside what's currently up there...
UDPATE: turns out it was mainly an .htaccess issue:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
First, take in consideration that this answer is just to make it work, I am not sure about any implications this may have in security due to every folder being in the public part of your site.
Second, I just tried this with a barebones laravel installation, so I'm not sure if this can have effects later in development (my guess is not, but you never know).
1) Copy all the contents of the public
folder in the root laravel folder (which is your subfolder)
2) You can now remove the empty public
folder
3) edit index.php
and change
// --------------------------------------------------------------
// Set the core Laravel path constants.
// --------------------------------------------------------------
require '../paths.php';
to
// --------------------------------------------------------------
// Set the core Laravel path constants.
// --------------------------------------------------------------
require './paths.php';
4) edit paths.php and change
// --------------------------------------------------------------
// The path to the public directory.
// --------------------------------------------------------------
$paths['public'] = 'public';
to
// --------------------------------------------------------------
// The path to the public directory.
// --------------------------------------------------------------
$paths['public'] = '.';
5) Edit the .htaccess file in the laravel folder to make it redirect no more into public
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With