1

I am looked around and still can't figure it out. I want laravel to only control certain folders of a website. I have a new client where I plan to build out an admin section for them in an admin folder. They will not setup a sub domain for the admin section. I want to build this in Laravel 5. The current site is a normal php with no framework or cms. Then as a phase 2 I am going to be cleaning up their site and also will want to convert this over to laravel framework. I am hoping their is a fairly straight forward way to do the admin section right away with Laravel and then go folder by folder and convert over their existing site.

Chris
  • 486
  • 3
  • 8
  • 22

2 Answers2

0

You can either handle this with your web server by not routing that URI to Laravel's index, or you can place files/folders inside the public folder of Laravel to be served like a regular flat-file PHP site.

See this answer too.

If you put your admin site in a folder inside of public called "admin", and made sure not to make any routes in laravel that used that "/admin" path, it should work just fine. Try it out!

Community
  • 1
  • 1
QuickDanger
  • 1,032
  • 11
  • 18
  • Thanks I will have to test it out. I don't have control over the environment as the site is on Rackspace Cloud Sites so the first option I think it out. Second option seems just like what I was hoping for. – Chris Mar 02 '16 at 01:56
0

All Laravel routes (urls, folders, etc..) are defined in the app/Http/routes.php.

This means that only those routes will be available via your application. Here is a sample routes.php and let's assume that your domain name is example.com

<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {   // <--- This route is example.com
    return view('welcome');
});

Route::get('/help', function(){ // <---- This route is example.com/help
   //logic
});


Route::get('/admin', function(){ // <--- This route is example.com/admin
   //logic
});

So you decide which links are available or not.

Can Celik
  • 2,050
  • 21
  • 30