Laravel:添加了.htaccess文件,现在它正在抛出NotFoundHttpException

时间:2015-03-17 19:04:42

标签: .htaccess laravel public

我已将laravel项目上传到共享主机:

~/public_html/baby/

baby - 是文件夹和项目的名称。

为了访问网页,我需要将/public添加到路径中,因此它就像:

http://domain.com/baby/public

我尝试从路径中删除/public字符串,最后我添加了这个.htaccess文件:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

.htaccess文件位置为:

~/public_html/baby/.htaccess

现在,当我试图在不添加/public的情况下访问网页时,laravel正在向我提出错误:

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException


Open: /storage/web/alexander/public_html/baby/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php

$others = $this->checkForAlternateVerbs($request);

if (count($others) > 0)
{
   return $this->getOtherMethodsRoute($request, $others);
}

   throw new NotFoundHttpException;
}

0 个答案:

没有答案