简体   繁体   English

index.php工作正常,但是http:// localhost / MySite /关于不工作

[英]index.php working but http://localhost/MySite/about not working

I aw bigginer in laravel, I am trying to show the pages like http://localhost/MySite/about . 我在laravel中使用bigginer,我试图显示类似http:// localhost / MySite / about的页面 I made the server.php duplicate index.php but when I type http://localhost/MySite/about in url the http://localhost/MySite/ is working but http://localhost/MySite/about is not working. 我将server.php复制为index.php,但是当我在url中键入http:// localhost / MySite / about时, http:// localhost / MySite /正常工作,但是http:// localhost / MySite / about却无效。 the error showing Object not found. 显示未找到对象的错误。 Please help 请帮忙

    <?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});
Route::get('/about', function () {
    return view('about');
});
Route::get('/contact', function () {
    return view('contact');
});
Route::get('/gallary', function () {
    return view('gallary');
});

I am not a Laravel guru, but it seems to me that /Mysite/ is causing this issue in your URL. 我不是Laravel专家,但在我看来/ Mysite /在您的网址中引起了此问题。 Are you sure that "localhost/Mysite/" is the webroot? 您确定“ localhost / Mysite /”是webroot吗?

If your building a laravel app from your localhost, the route to access is gonna be always 如果您是从本地主机构建laravel应用的,那么访问的途径将永远是

http://localhost/NAMEOFTHEPROJECT/public/VIEW HTTP://本地主机/ NAMEOFTHEPROJECT /公/ VIEW

If you still getting problems with the routes try to do the following 如果您仍然遇到路线问题,请尝试执行以下操作

Route::get('/ROUTENAME', 'Controller@METHOD')->name('ROUTENAME');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM