我是laravel在其中运行项目的新手,当我在RouteCollection.php第161行输入模块名称为url NotFoundHttpException时出错
这是我的 routes.php 文件代码:
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', ['as' => 'home', 'uses' => 'Landing@index']);
Route::get('/buyerregistration',['as' => 'buyerregistration', function () {
return view('buyerregistration');
}]);
Route::get('owarehouse/{id}', ['as' => 'owarehouse',function () {
return view('owarehouse');
}]);
Route::get('/SMM', ['as' => 'SMM',function () {
return view('SMM');
}]);
Route::get('productconsumer/{id}/{openwish_id?}',array(
'as' => 'productconsumer',
'uses' => 'ProductController@productconsumer'));
我的/ public文件夹中有 .htacces 文件:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
任何人都可以帮我解决这个问题, 感谢
答案 0 :(得分:1)
{xampp_dir/wampp_dir}/apache/conf/httpd.conf
并找到该行
#LoadModule rewrite_module modules/mod_rewrite.so
并删除之前的#。AllowOverride None
并将其更改为AllowOverride All
试试localhost/Opensupermall/public/SMM
此处的代码指向公用文件夹后的视图。
现在,最好的做法是在生产中使服务器的根文件夹指向/ public /文件夹
Route::get('/SMM', ['as' => 'SMM',function () {
return view('SMM');
}]);
因此,您只需在根目录名称后键入路由名称。