You are not logged in.
Pages: 1
This guide tells you how to host Laravel without requiring that the hosting environment allows you to change your document root path to your public folder.
There may be reasons why you cannot or choose not to change your web server's DocumentRoot configuration. Below are some other options.
Note: I tend to speak in hyperbole.
About Shawn McCool | About Big Name | BigTo.Do - FreshBooks time tracking for to-dos | Laravel IO - The Official Laravel Community Portal
Offline
Solution 1 - Alternate installation path with symlink.
This is the preferred solution and in general an all-around good idea. It's possible to install your application to a folder unrelated to public_html/ and then symlink the public folder to the public_html/ path.
For example:
Install your application to /home/applications/mysite.com
Imagine that your DocumentRoot points to /var/www/vhosts/mysite.com/httpdocs
Remove the httpdocs folder from the mysite.com vhosts folder then connect the two with a symlink: ln -s /home/applications/mysite.com/public /var/www/vhosts/mysite.com/httpdocs
Voila, clean as can be.
Note: I tend to speak in hyperbole.
About Shawn McCool | About Big Name | BigTo.Do - FreshBooks time tracking for to-dos | Laravel IO - The Official Laravel Community Portal
Offline
Solution 2 - .htaccess with mod_rewrite
This solution enables you to drop Laravel into your public folder then use a .htaccess file to redirect requests to the public folder. This solution places your application and core system code into a publicly accessible folder. This is not something that we encourage you to do with any PHP framework.
Step 1. Place Laravel in your document root folder.
Step 2. Place the following .htaccess file in your document root folder.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>Step 3. Make sure that you manually set your 'url' configuration in application/config/application.php otherwise Laravel will generate incorrect URLs. Make sure that each of your environments have the correct application.url configuration. For more information on environment-specific configurations see: http://laravel.com/docs/install#environments
That's all.
Note: I tend to speak in hyperbole.
About Shawn McCool | About Big Name | BigTo.Do - FreshBooks time tracking for to-dos | Laravel IO - The Official Laravel Community Portal
Offline
Solution 3 - merge the public folder into the installation root
This solution places your application and core system code into a publicly accessible folder. This is not something that we encourage you to do with any PHP framework.
Copy the contents of the public/ folder into your Laravel installation folder then change this line in your index.php file from:
require '../paths.php';
to
require 'paths.php';
Keep in mind that any bundles, libraries, or other types of third-party code may not be designed to be publicly accessible.
Note: It's also important to note that your bundles/ and public/bundles/ directories will now conflict. When using this approach you may want to not use artisan's bundle:publish task without knowing exactly what your bundles want to publish.
Note: I tend to speak in hyperbole.
About Shawn McCool | About Big Name | BigTo.Do - FreshBooks time tracking for to-dos | Laravel IO - The Official Laravel Community Portal
Offline
Pages: 1