Disable Laravel Routing for a specific folder/route

前端 未结 6 1220
陌清茗
陌清茗 2021-01-17 08:49

I\'m wondering how to disable the routing on laravel for a specific directory?

I am hoping to run my main website off of laravel (I\'m rewriting it into the framewor

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-17 09:40

    According to your routes.php file it is supposed to work.

    1. You are not catching forum URL at all
    2. If 'forum' directory/file exists, URL is not rewritten to Laravel's index.php

    routes.php (I used this one in the test case)

    Route::get('{slug}', function($slug){
        return $slug;
    });
    

    File structure

    |- app
    |- public
    |--- index.php // Laravel's one
    |--- forum // directory for forum files
    |------ index.php // Forum's one
    ....
    

    Using this structure, URL is not rewritten to Laravel's routing index.php file. If I rename/remove forum folder URL is rewritten then.

    Does it work for you?

提交回复
热议问题