我已将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;
}