I'm trying to get a Laravel 4 app installed in a subfolder of the web root directory for one of my users. I know there are major security concerns having the entire framework accessible via the web. I plan to address those separately after I understand how to get this working.
I've tried every combination of Apache Aliases, and Rewrite rules I can think of, but nothing seems to work. Here's my directory structure:
/home/username/public_html
.htaccess
my_laravel_app/
app/
bootstrap/
public/
.htaccess
index.php
robots.txt
...etc (standard Laravel 4 public folder contents)
vendor/
...etc (standard Laravel 4 files and folders)
The first .htaccess
file, the one listed directly under the users public_html
directory, contains the following:
AuthType Basic
AuthName Private
Authuserfile /path/to/.htpasswd
Require valid-user
The second .htaccess
is a standard Laravel 4 .htaccess
file. It contains the following:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I would like to essentially treat this my_laravel_app/public
directory as a webroot, so that the Laravel app functions the same way it would if for a normal Laravel installation directly on a domain.
I believe I just need to edit the first .htaccess file to contain rewrite rules that send any request to /my_laravel_app
to my_laravel_app/public
, but I can't seem to get this working. Can anyone help?