Support the ongoing development of Laravel.io →
posted 10 years ago
Configuration
Last updated 2 years ago.
0

you can simply, say place the public folder within the root an rename it laravelapp, but please make sure that the main laravel files outside of the public folder are placed outside of the root for security.

but then you will need to re-path some stuff with in the index.php file EG:

  require __DIR__.'/../bootstrap/autoload.php';

would need another ../ for instance to map correctly.

  require __DIR__.'/../../bootstrap/autoload.php';

hope this helps.

PS i do this most of the time for some projects as they run within another folder off the root, but shout any issue, as probably forgot to mention something.

Last updated 2 years ago.
0

Is there no other way, or is this the best way to do it ?

Last updated 2 years ago.
0

in the error you have the following url:

    htdocs/kcfibreglass.co.uk/dev

then its say

  htdocs/kcfibreglass.co.uk/dev/app/views/layouts/frontend.blade.php

Its looking in the dev folder for the app/views/layouts.. folder. If you have placed the rest of the laravel content outside the root then they should be located at:

   htdocs/app/...

Seems it might be a pathing issue and not finding the files. Try setting the following within the bootstrap/paths.php folder:

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

Im getting a different error than the one given as well:

 Trying to get property of non-object (View:/homepages/15/d271591959/htdocs/kcfibreglass.co.uk/dev/app/views/layouts/frontend.blade.php)
Last updated 2 years ago.
0

This how i have set up a project i have done, here is what i did for ref:

../vhosts/mywebsite.co.uk/htdocs
			- projectfolder/
 				- index.php
				- imgs
			- main site files etc
../vhosts/mywebsite.co.uk/ProjectName
			- views/
			- vendor/
			- boostrap/
			- app/

To keep my server clean i placed all the laravel specific files/folders like app etc with in its own folder so i know whats where etc. As above called 'vhosts/mywebsite.co.uk/ProjectName' Then i changed the pathing within the index.php file with in the 'vhosts/mywebsite.co.uk/htdocs/projectfolder/' to the following:

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

Hope this helps as well, but thought id share.

Last updated 2 years ago.
0

Ok i'll try that tonight when I get home, cheers dude

Last updated 2 years ago.
0

Still getting Trying to get property of non-object (View: /homepages/15/d271591959/htdocs/kcfibreglass.co.uk/dev/app/views/layouts/frontend.blade.php)

Last updated 2 years ago.
0

Still unable to get this to work... arrrrrrggggghhhhhh

Last updated 2 years ago.
0

Sorry, just back in. It seems it having issue with getting your view. Whats your view out put EG: View::make(...) etc

One thign i did forget to mention that if your palcing all the laravel specific code outside th eroot within a folder as i mentioned in my latest reply.

    ../vhosts/mywebsite.co.uk/ProjectName
           - views/
           - vendor/
           - boostrap/
           - app/

Then you will alo need to update the view.php with in the config folder to

App/config/view.php

    'paths' => array(__DIR__.'/../ProjectName/views'),
Last updated 2 years ago.
0

Mmmm, now getting View [layouts.frontend] not found.

Last updated 2 years ago.
0

why dont just use subdomain?

Last updated 2 years ago.
0

In what way, how ? This is my point

Last updated 2 years ago.
0

Anyone

Last updated 2 years ago.
0

On a live server (not locally) I want to show my laravel app like so:

www.domain.com/app then it show the site.

How can I do this? Can htaccess do this?

My htaccess is as follows:

<IfModule mod_rewrite.c> RewriteEngine on RewriteBase /dev RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L] </IfModule>

Also have my routes as:

Route::group(array('domain' => 'domain.com/dev/'), function() {

Route::get('admin', 'AdminController@login'); Route::post('admin/postlogin', array('as' => 'admin.postlogin', 'uses' => 'AdminController@postlogin')); Route::get('admin/dashboard', array('as' => 'admin.dashboard', 'uses' => 'AdminController@dashboard')); Route::get('admin/dashboard', 'AdminController@dashboard')->before('auth'); Route::get('admin/logout', 'AdminController@logout'); Route::get('admin/pages','PagesController@index')->before('auth'); Route::get('admin/pages/create','PagesController@create')->before('auth'); lots more routes but wont post them all.

main one /*

  • Frontend */ Route::get('/{slug}', 'HomeController@showPage'); Route::get('/', function(){ return Redirect::to('/home'); });
Last updated 2 years ago.
0

I did this with symlinking recently. Deployed the whole app into a folder above the public directory, then just symlinked the public folder.

/home/projectfolder/laravel/ [contains app, public, etc - not a public folder]

/home/projectfolder/public/ [main public directory]

Symlinked the folders - ln -s /home/projectfolder/public/dev/ /home/projectfolder/laravel/public/

Then I updated my Laravel .htaccess file to RewriteBase /dev - and that was it.

Good luck!

Last updated 2 years ago.
0

I dont have SSH access to do this ln -s /home/projectfolder/public/dev/ /home/projectfolder/laravel/public/

Last updated 2 years ago.
0

Just for other wanting to know how i eventually did this is as follows:

I created dev.domain.com in my domain control panel.

I then created a dev folder via FTP into my domain.com, so it would look like domain.com/dev, but I mapped this to dev.domain.com like so:

dev.domain.com mapped to domain.com/htdocs/dev/public, making sure you put the 'public' directory in there. This way everything in the Laravel app you built locally will work just fine.

Also make sure the permissions on the app/storage are correct.

After this you should be good to go!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lstables lstables Joined 5 Jan 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.