Reputation: 61
I'm new to laravel 4 and trying to figure out the best way to structure the files in my public_html directory.
Right now i have to go to www.mydomian.com/public/route to get anything to work. Not sure if this is correct or not. I supposed i could create a route to make that the default, but i'm just looking for best practices. Is that how you do it, or is there a better way?
Should only the public directory be in the public_html file or should i have all of the unzipped files from laravel 4 in its own folder?
Thanks
Upvotes: 0
Views: 1865
Reputation: 87719
A "Laravel 4" app is made from two set of files:
To start building you own app you have to clone the first and then "composer install" (or update) to "clone" the second via Composer. After that you'll have something like:
your/
+--- www/
+--- folder/
+--- yourAppDir/
+--- app/
+--- artisan
+--- bootstrap/
+--- composer.json*
+--- composer.lock
+--- CONTRIBUTING.md
+--- .git/
+--- .gitattributes
+--- .gitignore
+--- .gitmodules
+--- phpunit.xml
+--- public/
+--- packages
+--- .htaccess
+--- favicon.ico
+--- index.php
+--- robots.txt
+--- server.php
+--- vendor/
Basically you put your Laravel 4 app anywhere you want, but you have to point your virtual host to the /your/www/yourAppDir/public folder, where the main index.php file lies.
If you do that, you just have to point your browser to www.mydomain.com and you'll see your new Laravel 4 site, wich will call www.mydomain.com/index.php and all your routes will be something like www.mydomain.com/index.php/route
But you can use the .htaccess file to create some rewrite rules, to remove the index.php part of the file for you and you'll be finally able to access your routes using www.mydomain.com/route.
Upvotes: 3