Hello guys,
maybe some background information about me helps you a bit for helping me. I'm a .NET developer who is working on an ASP.NET project and at home I'm doing some small WPF projects with MVVM. So I'm used to C#'s coding and naming conventions. I've used CodeIgniter for learning MVC in PHP so far and it's pretty easy to use. Just unzipping the source, configure it and then I can start to create my content. If I want to remove "index.php" from all routs, I'll just add a .htaccess with code you find on the internet.
I want to switch from CodeIgniter to laravel, because of following reasons:
So now I'm struggling with the installation on my Windows machine with the latest XAMPP package. Is there a good and up-to-date tutorial for installing a Laravel project correctly on Windows with XAMPP? Also from what I've seen, deployment won't be as easy as with CodeIgniter, as you need to change the apache configuration (vhost), is that correct? With CodeIgniter you just create a package, unzip it and upload the sources to your webspace with no configuration other than the applicatioin configuration required. (Allows the user to use my software also on a free shared webhoster)
I hope you can help me with my questions. If anything is not clear to you, just tell me.
Regards, Stefan
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