Laravel使url可访问

时间:2017-04-26 21:57:55

标签: php laravel .htaccess

我有托管网站,我想访问旧网站。 我在名为old-site的目录中有它 在Exceptions > Handler.php文件中,我有以下代码:

public function render($request, Exception $exception)
{
    if ($this->isHttpException($exception)) {
        return redirect()->route('not-found');
    }

    return parent::render($request, $exception);
}

因为我需要将数据传递给未找到的路线。 但是当我尝试访问mysite.com/old-site时,它会抛出异常,但我想打开旧站点文件夹中的内容。我怎么能这样做?

1 个答案:

答案 0 :(得分:1)

只需将old-site目录放在Laravel的public文件夹中即可 如果您有默认的.htaccess文件,则向http://your.site/old-site/some-file.php发出的所有请求都不会重定向到默认的laravel index.php,它们将绕过该框架。
我刚试了一下它的确有效