I installed to wamp with composer following the instructions. I also uploaded to byethost shared host with no problems. When using composer don't forget to download laravel from github first.
Thanks the installation with downloaded sources and
composer install
worked for me.
composer create-project laravel/laravel --prefer-dist
didn't
But how will I release my application? How do I automatically use /public without the folder being displayed when I open http://localhost?
In my htaccess I have:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# below line added
RewriteBase /laravel/public/
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Usually laravel will have url's like:
localhost/mylaravelfolder/public/yourfile
public is in the url.
Hey guys,
sorry for digging this up, but unfortunately I had no time to answer.
Thanks @jimgwhit for your answer, but I've read that a .htacces solution would be critical for security reasons.
So is method 2 of following SO question's answer better?
(moving public content to root directory)
Regards,
Stefan
// Laravel 4
composer create-project laravel/laravel your-project-name
// Laravel 5
composer create-project laravel/laravel your-project-name dev-develop
--prefer-dist
is optional
I'd suggest you take a look at Laravel Homestead for your server. Initial setup might be a bit tricky but it's awesome stuff.
Forget about .htaccess or moving the public folder. Even with shared hosting you should be able to adjust the document root, so just set this to the public folder and you're good to go. Change your provider if it doesn't allow you to do that.
Here in Germany most free hosters I know don't offer Apache vhost editing (just drop your files via FTP set up a database and install your CMS or whatever) so changing the document root to /public is not an option.
I'm trying to create an alternative to Redmine (Ruby on Rails -> few free hosters) and for example Mantis (PHP, reliable but imho a PITA) with mobile first in mind and want everyone be able to use it easily if their hoster has the required PHP version and MCrypt which should be the case for many hosters.
So what's so bad about moving public to the application root? Codeigniter also has its index.php in the root folder and nobody has complained so far.
Well, don't use a free host then. You get what you pay for after all...
There are some great hosting providers in Germany, like all-inkl. They allow you to set the document root in their hosting panel. It's only like EUR 4-5 a month. And for the same price you can already get yourself a VPS, which is even better.
The bad thing is that you make all application files publicly accessible if you set the application root as the document root and there goes some of your security.
And as for Codeigniter, 25 years ago most new cars didn't have an airbag, now they all do and for a very good reason.
Well for me it's not a problem, I have a VPS hosted by Strato, but I'm thinking of potential users of my open source bug tracking system. And CodeIgniter has in every file following line which should add some security as the files are publicly accessible:
defined('BASEPATH') OR exit('No direct script access allowed');
(May add some security but it's still a PITA to include it in every single file)
But I think I'll stick to the normal project structure and tell my potential users to use solutions which are already posted here or on StackOverflow (.htacces, moving files to root folder, etc.) if anyone needs it.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community