简体   繁体   中英

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 . 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. 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. Are you sure that "localhost/Mysite/" is the webroot?

If your building a laravel app from your localhost, the route to access is gonna be always

http://localhost/NAMEOFTHEPROJECT/public/VIEW

If you still getting problems with the routes try to do the following

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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