laravel

Removing /public/ folder from Laravel


As inspired by CI ,

1. Create a “system” folder in root.

2. Move all the files to system except the public folder.

3. Move all the files form public to root folder.

It should now looking something like attached screen shot below.

Screen Shot 2014-08-22 at 1.21.11 PM

 

4. Reconfigure the paths

 laravelfiles/bootstrap/paths.php

'app' => __DIR__.'/../app',
'public' => __DIR__.'/../public',

Change these two lines to:

'app' => __DIR__.'/../app',
'public' => __DIR__.'/../../',

Find these lines in index.php

require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';

And change to:

require__DIR__.'/system/bootstrap/autoload.php';
$app= require_once__DIR__.'/system/bootstrap/start.php';

 

Now time to remove index.php form url 

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

 

Cheers enjoy.

Advertisements

7 thoughts on “Removing /public/ folder from Laravel”

    1. Above fix is for early version of Laravel.. I guess there are better options for new version of Laravel.

      For local : php artisan serve

      For production use .htacess

      RewriteEngine On

      RewriteRule ^(.*)$ public/$1 [L]

      Hope this will help

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s