VestaCP and Laravel
VestaCP and Laravel
Hi all.
Suppose I have a site called utilities.mydomain.com.
Inside there, I want to make several laravel projects in each folder.
eg.
utilities.mydomain.com/tool1
utilities.mydomain.com/tool2
utilities.mydomain.com/toolx
How can I make all these work with simply adding .htaccess file/s somewhere in utilities.mydomain.com or any other place?
Points.
a) I don't want to split the Laravel folders as I saw in other tutorials. Each folder must be a pure installed Laravel project.
b) I can make "utilities.mydomain.com/tool1/public" work with no problem with simply adding "composer create-project laravel/laravel toolz" inside the public_html folder, but I want to get rid of the "public/" term in the URL.
Thanks, Federico
Suppose I have a site called utilities.mydomain.com.
Inside there, I want to make several laravel projects in each folder.
eg.
utilities.mydomain.com/tool1
utilities.mydomain.com/tool2
utilities.mydomain.com/toolx
How can I make all these work with simply adding .htaccess file/s somewhere in utilities.mydomain.com or any other place?
Points.
a) I don't want to split the Laravel folders as I saw in other tutorials. Each folder must be a pure installed Laravel project.
b) I can make "utilities.mydomain.com/tool1/public" work with no problem with simply adding "composer create-project laravel/laravel toolz" inside the public_html folder, but I want to get rid of the "public/" term in the URL.
Thanks, Federico
-
- Collaborator
- Posts: 783
- Joined: Mon May 11, 2015 8:43 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: VestaCP and Laravel
You can do this with htaccess files.
utilities.mydomain.com/public_html/toolx/.htaccess
utilities.mydomain.com/public_html/toolx/public/.htaccess
utilities.mydomain.com/public_html/toolx/.htaccess
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /toolx
RewriteCond %{REQUEST_URI} !^toolx/public
RewriteRule ^(.*)$ /toolx/public/$1 [L]
</IfModule>
Code: Select all
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
RewriteEngine On
RewriteBase /toolx
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /toolx/$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Re: VestaCP and Laravel
just facing the same problem as @fedekrum and discovered your solution @tjebbeke , but after some tests it does not run for me ....
when we call the toolx url I have a message "Sorry, the page you are looking for could not be found"
and if I add index.php then I can continue but all the next links will display toolx/public/rest_of_url
Maybe because I run L5.6 ?
when we call the toolx url I have a message "Sorry, the page you are looking for could not be found"
and if I add index.php then I can continue but all the next links will display toolx/public/rest_of_url
Maybe because I run L5.6 ?