Ad

How To Set Routing Between Laravel And Custom Module?

- 1 answer

I have two modules one is a Laravel Extension and Second one is custom module(just some html,css,js file).

I have created Two folders as its project requirement. Let say Folder1(basic bootstrap home page) and Folder2(complete laravel Application).

Website Root

Folder1
--index.html
--css 
--js

Folder2
--app
--config
--database
--other laravel foldes 

How can configure routes so that from index.php I can call some controller of laravel with is in Folder2.

And From some view of laravel redirect to index.php in Folder1

I know its not perfect way to do that but its requiremnt of client and we cann't change that.

Thanks in Advance.

Ad

Answer

Do following steps make sure you have backup.

1.Put all content folder public folde to root folder so that laravel can understand this is your root.

2.Edit index.php and provide file path to them

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

$app = require_once __DIR__.'folder2/bootstrap/app.php';

3.Now laravel routing is working here. so all your laravel routs are now filne.

4.Now for all html files in folder1 you can make a .htaccess rules or make a general rule in root folder.

Redirect 301 /home /folder1/home.html.

5.Now when you access site.com/home it will redirected to folder1 and when you access site.com/laravelHome it will go to folder2.

Hope this will help you.

Ad
source: stackoverflow.com
Ad