禁用特定文件夹/路由的Laravel路由 [英] Disable Laravel Routing for a specific folder/route

查看:385
本文介绍了禁用特定文件夹/路由的Laravel路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在laravel上禁用特定目录的路由?

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

我希望从laravel上运行我的主要网站(我将其重写到框架中),但是我想保留我当前的论坛软件!问题是,当laravel看到"localhost/forums"时,它会寻找论坛的控制器或路由.我希望它只是转到文字/forums目录.

I am hoping to run my main website off of laravel (I'm rewriting it into the framework), but I'd like to retain my current forum software! The problem is, when laravel sees the "localhost/forums" it looks for a forums controller or route. I'd like it to simply go to the literal /forums directory..?

推荐答案

我必须将此行添加到public/.htaccess

I had to add this line in public/.htaccess

RewriteCond %{REQUEST_URI} !^/foldername

在此行之前(用于重定向斜杠)

before this line (that redirects trailing slashes)

RewriteRule ^(.*)/$ /$1 [L,R=301]

这篇关于禁用特定文件夹/路由的Laravel路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆